Precisely. Again, you must use an op amp that allows rail-to-rail input and output, or this won't work.
Think of it in terms of this op amp behavior: it "tries" to make both inputs equal. If + is 5V, then - will be 5V as well. That will apply (x-5) across Rin, and to keep - equal to 5V, the op amp will have to put 5-5(x-5) on its output (Ohm's law and the fact that the current through both resistors is equal).
Rail to rail means it can go very close to its power supply voltages. Hopefully someone else can suggest a good one, because I don't use R-R much and refuse to navigate DigiKey on my phone...