Q:

Login as different user in Gnome if you are have root privileges

I want to login as a different user in Gnome and not to run a single program only, but I don't know the users password, I don't want to know it and I don't want to change it, but I'm sudoer.
Is there any way to do so?
The best thing I could think, was to change the user's password but to keep the old shadow file. But this seems to me very ugly and also uncomfortable. I'm also not sure if it's a good idea to change the shadow file on a running machine (but I suppose so, otherwise vipw -s would kind of useless).
Is there an alternative?
The reason I want to achieve this, is that I'd like to test things or to configure programs for users who aren't able to do on their own. Yeah of course I could do everything on the shell als root or as the specific user (and acutally this is what I'm doing until now), but there are things that you definitly don't want to do on the shell. Did any of you ever try to change the position of the gnome-panel on the shell instead of just selecting "bottom"? :)
I don't think gksudo, sudo or su would help me. I want to have the whole gnome session.

A:

OLD-SCHOOL METHOD
Create a ghost user, with the same UID:
target: user1 (change to suit)
cat /etc/passwd | grep user1
user1:x:1001:1001:User1 Q Lastname:/home/user1:/bin/bash

add your ghost
sudo useradd -d /home/user1 -f -1 -u 1001 -g 1001 -M -o ghost1 -s /bin/bash -p MySecret

cat /etc/passwd | grep user1
user1:x:1001:1001:User1 Q Lastname:/home/user1:/bin/bash
ghost1:x:1001:1001::/home/user1:/bin/bash

su ghost1

NOTE: You can delete, with 'sudo userdel ghost1', but NOT when either account is logged in.  Failsafe method: delete the new line in '/etc/passwd' file.

