Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4685  / 2 Years ago, thu, may 19, 2022, 11:59:35

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.


More From » gnome

 Answers
5

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.


[#41361] Saturday, May 21, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
giccolla

Total Points: 161
Total Questions: 124
Total Answers: 117

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
giccolla questions
Sun, Oct 17, 21, 05:39, 3 Years ago
Mon, Aug 1, 22, 02:00, 2 Years ago
Sun, Nov 21, 21, 08:21, 3 Years ago
;