Why is it that when I added a non-root user and tried to make use of the "su" command to turn the user into root, it didn't work, instead I got the error message "permission denied". What else can I do to solve this problem?
Answered By
baygee
0 points
N/A
#98140
How to switch between non-root/root user in LINUX/UNIX?
If you have sudo facility in your system
you can do like this:
sudo "command" #executed as root
"command" #executed as normal user (if you log in as normal user)
"command"
sudo "command" # again executed as root
Â
How to switch between non-root/root user in LINUX/UNIX?
Hi Cypress Hill,
Â
Are you able to log in to the non-root user you created using "su -l 'username' " command. If possible, please try using "su -l" command to log in to root.
Â
If the above method doesn't work, use the below method
Â
You need to enter your user name into any of the group in /etc/group file. For this, please follow below steps.
Â
Open /etc/group.Â
Â
It will look like this
Â
Â
Now, just enter your username into any of the group.
Â
eg: wheel:x:10:root,new_user_name
Â
You can use as many usernames under a group, but you need to keep them comma separated.
Â
Hope it helps