Linked Questions
38 questions linked to/from Is there ever a good reason to run sudo su?
3 votes
1 answer
17k views
Deference between command "sudo su ls" vs "sudo ls" [duplicate]
I saw some command such as sudo su ls, and I just wonder what's the deference between sudo ls?
7 votes
2 answers
1k views
Difference between sudo -s and sudo su - [duplicate]
It might be a duplicate and I'm pretty sure I already saw an answer to this somewhere, but I wondered what are the differences in terms of rights and variables and other stuff between sudo -s and sudo ...
55 votes
7 answers
125k views
how to pass environment variable to sudo su
I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesn't work. How can I pass the env variable $DUMMY to su? -p doesn't work with -l.
45 votes
3 answers
138k views
This user is currently not available - but allow to run script by this user
I created special user in /etc/passwd with: secure:x:2000:2000:secure:/bin:/usr/sbin/nologin I don't want to allow login of this user (via console, ssh, ftp, any way). He is just for running one ...
8 votes
5 answers
103k views
How to access another user's folder from another user account
I have some downloads in my root user /root/Downloads folder. How can I access them from another not-root-user account?
9 votes
1 answer
35k views
sudo su in bash error "Cannot execute help: No such file or directory"
I installed zsh and changed root shell /bin/bash to /usr/bin/zsh. Then I rebooted and typed sudo su. It said "Cannot execute help: No such file or directory". So, I typed sudo bash. However, when I ...
11 votes
5 answers
11k views
What's the difference between sudo su vs just su?
I see a lot of posts out there that say you type in sudo su to get an interactive prompt with root privileges, and I see equally many posts debating the pros and cons over sudo -i vs sudo su. Here I'...
9 votes
2 answers
2k views
How does bash file redirection to standard in differ from shell (`sh`) on Linux?
I wrote a script which switches users while running, and executed it using file redirection to standard in. So user-switch.sh is... #!/bin/bash whoami sudo su -l root whoami And running it with ...
5 votes
1 answer
13k views
How can I have a root login shell with sudo?
My user is part of the admin group and I'm used to type sudo su to impersonate root. Unfortunately this generate a non-login shell and if I need one I need to type again /bin/bash -l. Is there any ...
2 votes
2 answers
16k views
Allowing `sudo su` without password over Ubuntu [duplicate]
This question is answered a number of times in the net, but none of those answer resulted useful in my case. The problem Accessing a remote machine using private key, I usually require root ...
5 votes
3 answers
3k views
Run script with arguments as user
I am trying to make sure when a script is run it is run as a specific user without having to su to that user before the script is run. Also the script is run with a couple of flags for example ./...
1 vote
2 answers
5k views
Does it make any difference to create ssh key as root or as user?
I want to create a ssh key, I wanted to know does it make any differences when I create the key as root and when I create it as user? like as a user I do this: ssh-keygen -t rsa -C "your_email@...
1 vote
2 answers
11k views
sudo su - anotherusername not prompting for password
I using Redhat linux. I am trying to run the following command and would like to know why it is not prompting for password? Here is what I am doing. I open the terminal window and enter my username ...
5 votes
2 answers
6k views
When can a user do `sudo su` but not `sudo su -`?
The following happened to me: $ sudo su - superman Sorry, user clarkkent is not allowed to execute '/bin/su - superman' as root in krypton101. However the following worked fine: $ sudo su superman ...
1 vote
3 answers
6k views
proceed execution of script after change user
I want to continue the execution of the script after change user, the script would be something like below echo "xauth add" `xauth list | grep ${DISPLAY:10:2}` >> test.sh sudo su ./test.sh ...