Tag Info

New answers tagged

1

Both programs are suid root. There is no reason to ever type "sudo su" except for the situation where one is unfamiliar with the "-i" and "-E" options to sudo, or otherwise in the habit of doing things as root without understanding why they're done. The su commands passes through a few hard-coded environment vars, while sudo can control exactly which ones ...


0

sudo su, sudo -i and all other sudo requires the users password. su requires the root password.


1

If you can use simply su, you should. But, in most modern (desktop-) Linux distributions (for example Ubuntu) the root user is disabled and has no password set. Therefore you cannot switch to the root user with su (you can try). You have to call sudo with root privileges: sudo su.


0

On some systems, su to root is not enabled for normal users, so sudo su is required.


2

Traditionally, interactive password problems are solved by using the expect command which creates an intermediary pseudo-tty to talk to the process. Here's an alternative python version using the equivalent python-pexpect package. Create a python file run.py: import sys,pexpect (pw,cmd) = sys.argv[1:] child = pexpect.spawn(cmd) ...


3

su and sudo are the two most common ways to run a program (possibly a shell) as another user (possibly root). They have the same effect, but they work very differently in terms of how they determine whether to allow the action: su requires that either the source user is root, or the user demonstrate that they have access to the target account (typically by ...


1

Sudo is an additional program which may or may not be installed on a system. It's available as package sudo on Debian. Without more information on the specific situation/code you are referring to, the most likely answer is that sudo cannot be assumed to be installed, why su is required to be present as by the POSIX standard installed as part of Debians base ...


2

You seem to have some editing errors in your post. There is a "&" missing for the sudo line, and you are using different names for your pipes later in the script. Here is something that works for me: #!/usr/bin/env bash mkfifo pipein mkfifo pipeout echo '/usr/lib/openssh/sftp-server <pipein >pipeout' | sudo su anotheruser & cat <pipeout ...


0

I'm not sure I understand your question completely but I think you are after something like this: sudo -u $USER sh -c "ls -la /home" | grep $USER Or if you want the pipe as the other user sudo -u $USER sh -c "ls -la /home | grep $USER"


1

Bash has two completion engines: a simple one that mostly only does completion of commands in command position and file names in argument position, and a fancy one that completes arguments based on the command. To get man page completion, you need the fancy one. When you start bash, only the simple completion engine is enabled. To get the fancy engine, you ...


5

Running su invokes bash in non-login mode. Bash then reads .bashrc to configure its environment. Runing su - invokes bash as a login shell. In this mode /etc/profile is executed if it exists. Bash also searches for ~/.bash_profile, ~/.bash_login and ~/.profile executing the first file it finds. Although not documented, it appears to execute ~/.bashrc ...



Top 50 recent answers are included