Linked Questions

1
vote
1answer
4k 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?
26
votes
4answers
60k 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.
13
votes
4answers
39k 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
2answers
1k 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 ...
1
vote
5answers
15k 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?
2
votes
1answer
4k 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 ...
1
vote
2answers
6k 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 ...
1
vote
2answers
2k 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@...
2
votes
1answer
6k views

Does “sudo su” makes me the root user?

I have typed sudo su in the Terminal, and then I typed whoami, and the Terminal said that I am the root user. So does that mean that sudo su makes me the root user or am I missing something?
1
vote
2answers
4k 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 ...
4
votes
3answers
251 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
3answers
2k 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....
0
votes
1answer
4k 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 ...
4
votes
2answers
2k 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 ...
2
votes
2answers
767 views

Executing Alias Command as Another User Fails

Not sure what I'm doing wrong here. User2 sources a file in it's .bash_profile to set environment specific aliases. # .bash_profile source $HOME/set_environment_shortcuts Inside $HOME/...

15 30 50 per page