The "substitute user" Unix command that changes the current user

learn more… | top users | synonyms

0
votes
1answer
37 views

Accidentally change sudo user to /bin/false

More Update In short, I have to execute a command (sudo nano /etc/passwd) using a Sudoer Account which I know the username and password but I have to login as a non-Sudoer Account trial #1 su - ...
2
votes
1answer
22 views

Auto source a script after sudo su

I am working on a machine that has some user accounts that are dynamically generated, and therefore I can not user customize the .bashrc or .profile. I frequently need to use these accounts to change ...
0
votes
0answers
4 views

Switch to user2 and load user1's bashrc automatically?

I want to switch to user2 from user1 and then instantly load user1's bashrc. For example: sudo su user2 And then as user2 run this cmd: source /home/user1/.bashrc I'm aware that maybe I shouldn't ...
0
votes
1answer
50 views

Spawn command line prompt to a remote Windows machine

Is it possible in Win7, Win8.1, Server 2K8 and 2012 to "shadow" or rather spawn a console and 'impersonate' or 'masquerade' a user command line prompt ? I am domain admin and I would like to interact ...
0
votes
1answer
84 views

how write in script bash: su - user, command, password, without ask me password? [duplicate]

i will create file sh (bash script) #!/bin/bash su - username -c XXXXXXXX xxxxxx= command where i put my password?( but NOT ask me password in terminal..how?)
1
vote
2answers
52 views

how to create a user with root privilege and fix this error?

I created an user with root access useradd -ou 0 -g 0 myuser -p [12345] when I try to su to new user, it's show me : : No such file or directory when I want to connect to that via ssh it's show ...
2
votes
1answer
33 views

What's the point to log in as root and do “su - user” instead of log in as user?

I have to redo a bash script (not originally written by me) and at some point there is an ssh connection with the user "root" and the first thing after that is : su - otheruser I don't really ...
1
vote
2answers
20 views

Running su noninteractively?

So, I got locked out of a server (sshd seems to have stopped responding). I got a reverse shell (added a jenkins job that gives me a reverse shell), but I've hit a snag - su wants a terminal, and ...
0
votes
1answer
62 views

The logic of Disabling Root Login

Ubuntu 14.04 VPS user here. My VPS was hacked twice. And the third version is up. Fingers crossed. The mistake I made in the first two was that I had root + password login enabled. I've learned ...
0
votes
1answer
47 views

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

I am talking about authentication without needing user intervention like specifying password and username in the command file so that user don't need to input anything to switch user. For example: ...
1
vote
1answer
73 views

Can't run /bin/bash… sometimes?

I’m on a Google Compute Engine which is running Debian Wheezy 7.4. I’ve been noticing strange things recently. For example, I can do sudo bash. But then, from root, I can’t do sudo -u anotherUser ...
0
votes
1answer
336 views

Require bash script to be run with sudo (not as root user)?

I want to require a bash script to be run as the current user with sudo, but prevent it from being run if it was executed as the root user directly. This is because I'm doing some setup actions for ...
0
votes
0answers
22 views

PAM authentication problems with su - $username

When I try to su - postgres as the root user, I immediately get su: Authentication failure This is my pam.d/su file # Begin /etc/pam.d/su # always allow root auth sufficient pam_rootok.so ...
0
votes
0answers
20 views

Possible to su and run both .bash_profile's?

I currently log into the boxes at work, then: su - <adm_user> My question is, is it possible to pass through to the su'd user, my bash profile and source the adm_user's bash profile?
0
votes
0answers
18 views

Mounted Share from TerraStation file server - can't change file or directory permissions

I am trying to delete files from the TerraStation share in a subdirectory. These are marked by TS as having permissions issues. Through a terminal window (Mac, OS 10.10, CentOS) I su then cd to ...
0
votes
0answers
20 views

Cannot remove a file

I used Cryptonite to encrypt a file then my device was shutdowned suddenly. Well, I cannot decrypt the file anymore. This's what I catched in the logcat when I try to encrypt the file once again: ...
0
votes
0answers
50 views

Windows equivalent of su

During start up, Group Policy can be used to run scripts before user log in. These scripts run as the local system account, which I understand to be effectively like root. I'd like to run a script as ...
0
votes
1answer
155 views

Difference between su and su -c (environment variables?) when running db2?

When I type this: su <user> -c "/home/<user>/sqllib/bin/db2 catalog tcpip node <dbName> remote <ip> server <port>" I get this error message: SQL10007N Message "-1390" ...
1
vote
2answers
390 views

How to drop privileges in a script inside a non-interactive shell?

I'm using Docker to create images that I can run as containers. I'm configuring my image all as the root user, including setting up volumes and other things. But once I've got all that configured I'd ...
2
votes
1answer
84 views

In bash 4.3.27 “su” ignores user variables when combining “-” with “-c command”?

Since forever we used to launch user scripts from a different user crontab like this: 00 12 * * 1 su - user2 -c "/home/user2/myscript.sh" By doing this, the script is launched after the interactive ...
4
votes
1answer
2k views

sudo su “username” vs. su “username”

Please explain me, what is the difference between: sudo su "username" vs. su "username" Which has higher privileges? If I log into root with sudo su "username", I am root for one command only? So it ...
3
votes
2answers
97 views

What makes the differences between `sudo CMD` and `sudo su` followed by `CMD`?

I have an SSH server with key only auth and I want to add a key for a new user. I log in with one user(kidmose), I try to append the key to a new user's(remote) authorized_keys and it fails: ...
0
votes
1answer
90 views

Replacement for “su user_with_sudo; sudo -s” for user without sudo-rights?

Let's say I have two user accounts: user (without any sudo permissions) user_with_sudo (with all sudo permissions) Now, I'm logged in as user but want to do something as root, e.g. switch to a ...
2
votes
1answer
46 views

Check if Logged In via ssh or su

Let's say I'm called to a workstation and I face a console and I want to know if the current user logged in via ssh or su. How can I check that?
2
votes
3answers
175 views

Using su - (user) to open privileged port not working

So I wanted to run a Node server on port 80 but I didn't want to run the entire process on root privileges, for security I thought this would be the best. So I thought a good solution would be to use ...
1
vote
2answers
288 views

Running Screen after switching users

After switching users (with su) I cannot run screen: % screen -L Cannot open your terminal '/dev/pts/5'. How can I run screen after switching users?
0
votes
1answer
134 views

Difference between su vs root SSH login for mounting?

I have a bash script luks that I use in Android for mounting/umounting encrypted devices, that can be called in a terminal emulator with su -c "luks ..." The script works ok for the first part, ...
1
vote
2answers
2k views

Permission denied when attempting to mv (sudo su userName)

I am currently working on a backup script to log into my production server and pull the latest SQL dumps to my staging server. I have no issue pulling the SQL dumps but I do have an issue with moving ...
0
votes
1answer
567 views

Run startup script with another user

I have two users user1 and user2. And tomcat has owenership of user1 and started with user1 only. I need to make a rule for user2 such that user2 can starts/stop tomcat but tomcat should always be ...
0
votes
0answers
1k views

SU : Permission denied /bin/sh

I added a new user in system: $ useradd new_user When I try to switch from root to new_user, I get this error: $ su new_user permission denied /bin/sh $grep new_user /etc/passwd ...
0
votes
1answer
2k views

script to su with password in script without root

I have scripted a process that involves updating symbolic links on files located on 3 different machines. On those machines exists 4 users each, who each need to have these links updated. Using su, ...
0
votes
0answers
42 views

ec2 enable su for user ubuntu

I am trying to enable rstudio-server login with ubuntu on ec2, but it fails. I think it uses the same auth mechanism as su. So I did sudo passwd su someotheruser su ubuntu But even though I know ...
1
vote
2answers
301 views

How do i run su username -c “command ” in a sequence

am trying to write a script that runs commands in a sequence as a user but su keeps doing every command at the same time instead of running them one after another the script looks like su username ...
1
vote
0answers
1k views

What is the different between “sudo su” and “sudo bash”?

In Ubuntu 13.10, for the default setting, the following command in Terminal user@host:~/path$ sudo su results in entering an prompt root@host:/home/user/path# And this command ...
2
votes
1answer
820 views

Debian disable su to root user

I am currently using Debian 7 (Wheezy) and I am trying to disable the su command only when the target user is root and not a privileged user. For example, let's suppose the following users exist: ...
2
votes
1answer
2k views

“chmod -R 777 /” for a few seconds - now what?

On Centos 6.5 I accidentally typed chmod -R 777 / Ooops. I CTRL + C'ed out of it very quickly, but not before it'd started working away for a couple of seconds. Consequences? Well, already su ...
2
votes
3answers
6k views

How to login as root from Bash and do stuff

This is my simple bash: cat test.sh #!/bin/bash echo "hello" su - root -c /path/to/script.sh <<EOF password EOF whoami echo "good bye" But I get this error: ...
2
votes
1answer
536 views

difference between root executing command as sudo vs not using sudo?

I have a Linux question regarding the sudo command and the root user. If I log into the root user using the su command, what is the difference between the following two commands? root> sudo ...
1
vote
3answers
1k views

How to exit the super user from middle of shell script?

I have a shell script in which most of the commands need to be run under sesu user and then I need to run some commands as current user. Can you please help me in this?
0
votes
1answer
49 views

Cannot access su in fedora 17

I am using Fedora 17. by mistaken, I have given full permission as root, for all the files in /usr/bin My command was chmod 777 * and also I gave full permission for a file(I can't ...
9
votes
1answer
1k views

Debian - allow user to be root only for specific commands

We have several Linux boxes running Samba that are used 'locally', eg each branch gets their own Samba box to store and share files. The office managers need to be able to add and remove users for ...
1
vote
2answers
1k views

su & sudo on Mac OS X 10.9/Server 3.0

I am trying to use su and sudo on my iMac that I did a fresh clean install of Mac OS X 10.9 and Server 3.0. I explicitly set the password for root with passwd root but when I try to use su or sudo ...
1
vote
2answers
48 views

How to see history of commands entered as superuser

Is there a way to see the commands that I entered in su mode? Similar to the ~/.bash_history? Where would this be located?
4
votes
1answer
53 views

Why does cifs asks for su rights to write any data into it?

I'm mounting a windows share as follows: sudo mount -t cifs //192.168.178.49/public -o users,username=name,dom=domain,password=pword /mnt/nas Then I'm trying to create a simple file with some basic ...
2
votes
1answer
2k views

SSH: remote switch user and execute command under this new user

I am able to connect to remote machine using public/private keys (without password) as user wakatana. On remote machine I am able to issue: sudo /usr/bin/rootsh -i -u root then I type root's password ...
0
votes
1answer
375 views

How to have a user who can 'su' to another user but not allowed to 'su' root

In my server, I have 2 groups: ssh-users and su-users ssh-users hold users I ssh to the box with. User sshu is a member of ssh-users. Once logged in to the server, I want ssh-users members to be able ...
1
vote
5answers
4k views

Alternative for sudo

I am aware that we can execute a command/script as a super/another user using sudo command. But Is there a possibility where the sudo utility itself is unavailable/removed by the user. If so, what ...
0
votes
1answer
1k views

How can I list all users who can su into a generic account

I have a generic account several users can su into, I however would like to find the name of all users who can do this. Thanks, Oscar
4
votes
1answer
114 views

Using su with commands

Ubuntu Server 12.04 On a remote server that I ssh into I have set up a special user with: sudo adduser --system --disabled-login --disabled-password --group suser to run some maintenance functions. ...
1
vote
1answer
2k views

su not working when non-root (authentification failure)

On a VPS I own (hosted at bluevm.com), I have three users: userone, with password foo, and sudo rights. usertwo, with password bar, without sudo rights. root, with now password (deleted with passwd ...