su is a utility to run a shell or other command as another user (root by default).

learn more… | top users | synonyms

0
votes
0answers
37 views

Use sudo as login

I've picked up the habit of using sudo and disallowing root logins. In cases, sudo is integrated with GUI configuration tools that require it. Are there any serious efforts to replace login and ...
2
votes
0answers
22 views

Bind a directory as me

Analogous for a regular user running a thin FTP server (where others can access the file system with his/her permissions), can a regular user (through fuse maybe) "mount" a directory for others to use ...
2
votes
2answers
60 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 doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.
1
vote
3answers
57 views

Differences between sudo and su in inheriting environment

Why can the command run by sudo inherit the environment from the parent shell process, while the shell process after sudo su to the root user doesn't? t@ocean:/tmp$ export ME=tim t@ocean:/tmp$ sudo ...
1
vote
0answers
46 views

Decrypting with GPG after a “su - different user”

I have cron job running a script in the cron of "USER A" that encrypts many files in a loop using the gpg command below: gpg --batch --cipher-algo AES256 --passphrase "PASSWORDISHERE" -c FILENAME ...
0
votes
2answers
68 views

executing command as su

I am executing this command as su. I have made the connection with SSH (using sshNet), and then when I try to set the command su -, I get no response. I have the password and the command I would like ...
1
vote
1answer
63 views

Running some parts of a script as an unprivileged user with shell environment

I am creating an instance configuration script that sets up a machine. I am running the script via sudo i.e. sudo run.sh. Most of the steps require root access but some of the script's steps do no ...
2
votes
3answers
236 views

Why root does not source .bash_profile?

Everytime I try to login as root using su (not su -), it doesn't source .bash_profile in user1's home directory. Basically my /var/root directory doesn't have .bash_profile, so I put a copy of ...
0
votes
2answers
51 views

Run script on non-full bash-login invoked as “sh”

Good day I'm currently trying to modify my terminal to have the prompt displayed in a different colour than the whole rest of the shell, and I would like to make it white for normal users and red for ...
1
vote
1answer
23 views

Can't switch to a specific system account with su

I can't switch to user jenkins on an OpenVZ container. There is still a jenkins process running, which was started by this user. I tried # su jenkins; it does not switch to the jenkins user. There is ...
1
vote
2answers
73 views

su -c command fails when sending db2 commands

I have a script I've setup to run a number of tasks, one of which is to set up a table in a DB and later remove it (for automated testing). The issue comes that on only a few of the users that I use ...
0
votes
2answers
62 views

Why doesn't `sudo su -l -c “java”` work even though `sudo su -l -c “echo $PATH”` displays the location of the java binary? [duplicate]

I have a server with Java binaries from a tarball on a custom location, and the following in /etc/bash.bashrc: export JAVA_HOME=/path/to/java/home export PATH=$JAVA_HOME/bin:$PATH When I run sudo ...
3
votes
3answers
120 views

SUID accidently removed from /bin/su file

It is a production server - CENTOS 6.1 Some user having root access in the past had logged on to the server and removed the SUID bit from the /bin/su file and then exited root. Now we are not able to ...
1
vote
2answers
86 views

Any special permission ssh remote command working on fifo file(aka named pipe)?

I need to redirect some strings to a fifo file with ssh remote command, but always got permission denied, the command I executed is: ssh rundeck@nagios1 sudo su - root -c 'printf ...
0
votes
2answers
65 views

provide password for script begin called inside another script [duplicate]

I have written a shell script which in turn calls another script, but the second one prompts for password. I want to supply the password and pass the prompt without user begin notified. Here is my ...
1
vote
1answer
79 views

su or sudo keeping/removing certain environment variables

I would like to be able to log in as another user and keep most, but not all of my environment. Specifically, I would like to set $HOME to the correct value for the new user, but keep probably ...
1
vote
1answer
44 views

How to switch user with pre-configured credentials in SSH Terminal after logging in as standard user

I was wondering how to execute a command file where: After logging in as a standard user, I want to switch user to "username" with password being "password", I can successfully execute the command.txt ...
0
votes
1answer
59 views

shell scripting and running after switching to other user

I have the following commands that I want to have them all in one shell file: su – s3 lizinfo.sh –b when the first linex executes, it prompts and the command prompt become like as below: ...
0
votes
2answers
45 views

Ubuntu CentOS RHEL cross bash script su support

I know that title was a little ambiguous. Allow me to explain our issue. We designed an installer script on Ubuntu since Debian based systems are our primary core, however, some of our cloud based ...
0
votes
2answers
50 views

Maintaining the Current Style of the Command Prompt After Using 'su?'

When I use the su command in OS X's Terminal — say, to quickly switch to an administrator account to mount a drive using diskutil — the style of the command prompt changes. ...
6
votes
1answer
150 views

When running 'su - username', pam_group doesn't add additional groups from /etc/security/group.conf but sshd login does?

I am having trouble determining why su doesn't behave as the PAM configuration would imply. In short, using su to become another user should load secondary groups according to PAM configuration, but ...
0
votes
1answer
48 views

Is there a way to see which user is logged into the system and has switched with “su”?

There are many person that may have access to the system and use a common user with more grants. How can I see which user is running a command? is there a way to use "ps" for that?
-1
votes
2answers
180 views

Is it possible to write a script that run su or sudo command without typing password? [duplicate]

Is it possible to write a script that run su or sudo command without typing password?. I googled and its said that su doesn't read password from buffer. So is there any solution?
3
votes
2answers
454 views

Is there a graphical sudo (kdesudo, gksudo, su-to-root, …) tool that works passwordless?

Apparently gksudo is not obeying /etc/sudoers, neither does kdesu. Therefore asking the other way around... Is there any su-to-root, gksudo, kdesudo, etc. alike tool, that supports starting gui ...
3
votes
1answer
37 views

limits.conf modification doesn't work

On a SLES 9 machine I added the line: vi /etc/security/limits.conf USERNAME hard cpu 70 but when I check it with "ulimit -a": SERVER:~ # su USERNAME USERNAME@SERVER:/root> ...
0
votes
1answer
42 views

/etc/sudoers file help in giving access to all command in UNIX

/etc/sudoers file help in giving access to all command in UNIX. I read it has rules specified like #root ALL=(ALL|ALL):ALL that specifies root accesses. My question is when we execute a command ...
0
votes
2answers
1k views

Unable to su into an account: could not open session

in my Linux machine - red-hat I successfully to login to different users as the following su - userC [machine@Linux ~]$ pwd [machine@Linux ~]$ /Users/userC but only in one user I get the ...
1
vote
1answer
33 views

How to propagate TSTP while running a program as a different user

I'm running a terminal application via "su" in this fashion: su -c "/path/to/app --args" username This is done from a root context, and 'username' is a less privileged user in the system. The ...
0
votes
1answer
481 views

Bash script class path issue with java

Content of /opt/scripts/jvm/jvm.script.sh #!/bin/bash JAVA_HOME='/java' PATH="$PATH:/$JAVA_HOME/bin" java -cp ./classes:./lib com.mystuff.bar.foo.myclass & Content of /etc/init.d/init.script.sh ...
1
vote
1answer
1k views

Ubuntu runuser command?

I am creating a bash script that requires to run commands as a specific user. As a result I am using the command: runuser I have tested this script and it works perfectly in Ubuntu Server 14.10. ...
2
votes
1answer
85 views

Problem with either su username -c “./script.sh” and sudo -u username bash -c “./script.sh” and Java classpath

I am seeing some strange behavior that has led me to wonder how the environment differs when running either of these 2 commands, versus using su username and then running the commands as the user one ...
1
vote
2answers
126 views

Fedora: How can I add myself back to sudoers file?

I've accidentally removed myself from sudoers file by doing usermod -G user group without -a, and now I am not in the sudoers group. I've tried doing su - and entering root's password but it says su: ...
1
vote
1answer
66 views

Accidentally deleted /bin/su

I was working in /bin on my Ubuntu system and ended up deleting su via a typing error while trying to do other editing. So now I have no way of swapping back and forth between users and root. I have ...
5
votes
2answers
82 views

Permissions depending on how you login: ssh/su/sudo

As user I have access to a remote linux machine where I can: sudo su - other_user Among other things, this allows me to add my own public key to authorized_keys for other_user, which effectively ...
3
votes
1answer
65 views

su - -c 'll' other_user results in error, how can I run this other user's alias?

In current bash session, I just want to change to another user for some bash command. The command is aliased to some script defined in another user's .bashrc or .profile. Am I able to make it ...
1
vote
1answer
609 views

su cannot execute bin/bash/****

I installed Kali Linux on a VM machine and I cannot change my user to root from the terminal using su. The command sudo works fine but when I try to su, it says "cannot execute bin/bash/****(my user ...
1
vote
0answers
52 views

Some commands does not work in su envirorment

I have logged in to CentOS 5 machine with normal user and then I used su command to login as root user. Now commands like ifconfig, useradd, userdel are not working on machine and it gives command not ...
2
votes
2answers
1k views

Unable to pass the password to su in a script

I am writing a build script. This script has to copy a file in the end. This file will be placed in another users home directory and it is also necessary that the file belongs to this second user. My ...
3
votes
3answers
1k views

What mechanism prevents any user from accessing any other user's files via root?

On a multi-user system, what protects against any user accessing any other users files via root? As context, the question is based on my understanding as follows: There are two commands related to ...
3
votes
3answers
62 views

Understanding a couple of points regarding root privileges

I just wanted to confirm my understanding of a couple of things related to root privileges. Is it correct that: The user name "administrator" is not a reserved name with implied privileges, it is ...
0
votes
1answer
212 views

Is it possible to set the users .gitconfig (for git config --global) dynamically?

I have the problem, that we login to the systems as our own users johndoe and then have to do a sudo su - root to be able to do administrative tasks. We have the system config files in a git ...
1
vote
3answers
689 views

Pass arguments to a command run by another user

I have a bash script that is supposed to take some arguments and then run in a different user: test.sh #!/bin/bash sudo su user2 <<'EOF' echo $1 EOF However it prints blank: $ ./test.sh ...
1
vote
2answers
505 views

How can I sudo su and change directory just after?

I would like to create an alias that does something like this: alias userYYY='sudo su userYYY; cd /a/path/that/only/userYYY/has/access' So then from my command line, I am logged in with a sudoer ...
2
votes
2answers
350 views

how to write a script that will run commands after su, without using -c

I'm trying to automate a standard activity on a system I do not have root access on. The administrator of the systems have given me authority to run sudo su - 'user' command, and only that command. ...
1
vote
1answer
63 views

Why can't I login in as the ftp user?

After installing vsftpd I have the user ftp on my system. I assigned a password to this account. However, I still cannot login as the ftp user (on the command line, without any ftp-protocol involved). ...
1
vote
1answer
334 views

Permission denied when trying to run script as other user

I'm trying to run a script as another user that starts a piece of software (Etherpad), which is run like so (from root): su -c "/var/www/etherpad-lite/bin/run.sh" -s /bin/bash etherpad but I'm ...
5
votes
1answer
423 views

Getting the process-id out of command launched with “su -c”

I am running a java program inside a shell and writing the process-id to a text file. So when I do this: nohup java app.Main > /dev/null 2>&1 & echo $! > /var/run/app.pid It works. ...
5
votes
1answer
952 views

What does su - `whoami` command do?

I am running a script in my project and I see this command su - `whoami` I am having a few basic questions: What does this command do ? What is the significance of `` quotes outside the whoami ...
3
votes
1answer
108 views

Difference between sudo -s and sudo su -

It might be a duplicate and I'm pretty sure I already show an answer to that somewhere, but I wondered what are the difference in term of right and variable and other stuff between sudo -s and sudo su ...
2
votes
1answer
131 views

What do I need in my script to be able to change ownership of a directory structure that belongs to root to the current user running the bash script?

My bash script has the following section: su root -c chown -R smithb:other /export/home/smithb/workspace/rootownsit/ exit The directory rootownsit and its two sub directories were created and is ...