Questions tagged [su]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

SCP with login to server and login to app user

I am trying to copy files from my local machine onto a remote server. The only issue is that I must first ssh user@host, enter my password, then sudo su - appuser, and enter my password again. I have ...
0
votes
0answers
10 views

Setup Password Less login direct to appuser

My current work setup for our servers requires me to ssh user@server1 and then enter in my password. I then have to sudo su - appuser after and enter in my password again to get to the files that I ...
0
votes
1answer
21 views

Left arrow key prints `^[[D` when I do `sudo su otheruser` on headless Ubuntu 18, via ssh using MobaXterm on Win 10. How do I move one char left?

I sometimes need to login as the application user to do some manual operations, debugging, or handling a failure. I don't want to go into our password management system to fetch the application user's ...
0
votes
0answers
43 views

Windows Terminal - login to SSH, su, and keep terminal tab open

I'm trying to set up a profile on Windows Terminal that does the following: connect to ssh server login with username & password su enter su password keep terminal tab open Here is what I've ...
1
vote
2answers
47 views

I can not su or sudo -i as root, and also can not ssh as root.But they all can work with other users

The screenshot Doesn't work as root sudo -i and su can not work as root. [atguigu@hadoop103 ~]$ sudo -i [atguigu@hadoop103 ~]$ su Password: ssh login as root and it was closed instantly. [atguigu@...
0
votes
2answers
25 views

With `su <name> --login`, what's the alternative to --login?

The man page for su states that for su <name> --login, adding the --login makes it a login shell. What's the alternative to this? I assumed that since you're changing the user, you have to log ...
0
votes
1answer
42 views

How do I go about removing a built-in application on MacOS Catalina 10.15.6?

Here are the things I've tried... I'm within /System/Application, went into Finder and was able to change permission to custom and have set both Admin/Everyone to Read/Write. Disabled SIP Became root ...
1
vote
0answers
29 views

su and passwd : Authentication error

I had a strange behaviour with su - command. In fact I can't use /usr/bin/su - to get to root account. I use sudo which works perfectly but some other users, also in sudoers, are able to change sudo ...
0
votes
0answers
17 views

Keep user's environment variables when using su with another user shell (invalid option — 'm')

I'm at the root user shell and i have some environment variables already set. I call su - user -c 'echo $VARIABLE' but that just prints me blank line There are similar questions like that https://...
0
votes
0answers
38 views

chown fails on macos [duplicate]

# whoami root # chown username /usr/local chown: /usr/local: Operation not permitted How would I get out of this predicament? This is an icing on the cake: # mv local local_ mv: rename local to ...
0
votes
0answers
58 views

Add command “su” with account disable-login in script sudo

I need to run a script with "sudo" right and at some point in the script I have to run a program with "(su $TS3_USER -c "$TS3_DIR/ts3server_startscript.sh start")" to ...
1
vote
1answer
19 views

Run CI command as non-root using su

Our CI servers use docker images that are all running as root. Now I have a Maven build that can't run as root, so I'm trying to build this wrapper script for creating a user, copying the Maven ...
0
votes
0answers
15 views

Why doesn't team “usermode” work under superuser?

The usermod command successfully through sudo. sudo usermod -aG some_group some_user However, if you execute it through su, then there will be an error. su ...I enter root password... usermod -aG ...
0
votes
1answer
145 views

Ansible: Switching to su user and when running tivoli db2 command, gives command not found

when manually ran db2 command on the server works. But when executing using ansible which switches to the user but fails to run the db2 command. I am stuck on this issue for the whole day. Any ...
0
votes
0answers
41 views

Why did “su” stop working in my xfce terminal?

I recently tried to log into a xfce4 terminal as root. When i enter su it asks the password, i enter it and then, it hangs forever. I can not even stop the process with ctrl+c... su hanging forever ...
0
votes
0answers
92 views

user with restricted bash: sudo su works but su doesn't

I'm creating an user with restricted bash. I've blocked all commands except few commands as per a requirement. Now if I want to change to root using su - root, even with correct password, it says ...
0
votes
1answer
53 views

Su Into New Environment and Run Command from New User As Alias

I would like to run a su - <desired_user> but then also execute a command. I want to become that user in the new shell but just source a specific file. The desired_user above is a batch user, ...
1
vote
0answers
15 views

sudo asks password although there is nopasswd parameter [duplicate]

I edited the sudoers file like below: myuser ALL=(ALL) NOPASSWD: ALL newuser ALL=(ALL) NOPASSWD: ALL There is no another line that contains "myuser" in sudoers file. But ...
0
votes
1answer
91 views

How can I change user and keep my .profile

I often have to work as root (using sudo), but I want to keep my settings from my login profile - I have had this working in the past, but I don't quite remember how I made it work. This is what I've ...
0
votes
1answer
43 views

command su returns prompt-less authentication after editing password through passwd as root user

I made absolutely no change except for running password <user> as root. After logging back in as <user> and running, for example, su pkg install rsync mtr I am returned the following su([...
0
votes
1answer
141 views

How to su into another user and run commands with subsequent interactive shell

My goal is to su into user2, run commands that reference user1's environment, and also initiate an interactive shell as user2. I'm trying to create a function that allows me to keep forwarding X after ...
8
votes
6answers
2k views

Allowing automatic command execution as root on Linux using SSH

What is a good setup that allows automatic execution of a command or a script on a remote server with root privileges using SSH? I'm aware (only vaguely for some the options) of the following options: ...
0
votes
1answer
47 views

-c flag missing from su under macOS?

I am using El Capitan 10.11.6 and need to use su -c to run psql as the _postgres user. The problem is, this flag is absent on my version of macOS. Can't speak for other newer versions of macOS (...
0
votes
1answer
135 views

Only allow rbash user to su

I want to have a user that has set rbash as its default shell to only use the command su. I have tried to create a folder "bin" in the home directory of the user and copied the binary su (/bin/su) ...
0
votes
2answers
87 views

Cannot log in with SU on MacBook Air

Using MacBook Air with Mojave 10.14. While in Bash using terminal app, The SU command ask for password. When I put my user password in it says Sorry try again. My apple password does not work either.
0
votes
0answers
179 views

sudo su ask target user's password

sudo su asks for invoking user's password as default sudo behaviour. With Defaults rootpw it will ask root's password. But is there a way, to make sudo su behave like su? Like it'll ask password of ...
-1
votes
2answers
721 views

SU Level Access Denied

I’m a newbie to Linux and have been over sometime setting up a NAS box based on an old Iomega NAS box modifying the installed software, mostly successfully. I haven’t done anything with it for over a ...
0
votes
1answer
40 views

Executing command via sudo fails when multiple words

Running a command with two parts fails with sudo but not with su. root@hello:/var/www/hello# sudo -u root "echo hello" sudo: echo hello: command not found root@hello:/var/www/hello# sudo -u root "...
0
votes
2answers
1k views

Running command via su as www-data user fails silently

I am trying to run a daemonised webserver as www-data user but I have reduced the problem down to the fact I can't even run the simplest of commands using su. root@ubuntu:/var/www/hello# ls -la total ...
1
vote
1answer
417 views

Can't `su` to another user with login shell

I'm working on the Linux From Scratch project, and I've got a very basic problem I can't figure out. I'm told to use su - lfs to change to my "lfs" user. If my understanding is right, the center dash ...
1
vote
1answer
3k views

Run command from sudo su

On a machine I (tlous) have been given access to open a shell as another user (serviceAccount) Executing: sudo su - serviceAccount has the desired effect of opening a shell as this serviceAccount ...
1
vote
1answer
516 views

su another user through ssh with a local script

I have the following snippet: ssh root@"${DO_DROPLET_IP}" -i "${SSH_PRIVKEY_PATH}" su www -c sh -c -- \ "./server-user-setup.sh" "${BB_USER}" "${APP_USER}" which is inspired by the following (...
1
vote
0answers
82 views

Cannot do su in CentOs

I have troubles with su on system that is attached to Active directory. [user1@host_test ~]$ su - username Password: su: Permission denied [user1@host_test ~]$ But i can access server with ssh [...
3
votes
1answer
255 views

LFS 8.2, cannot change user to root

I have a problem with my Linux From Scratch 8.2 system, because when I login as normal user and then try to switch to root using su command, it prints "Authentication failure" even after entering ...
1
vote
1answer
431 views

Root user to execute a script without privilege but allow sudo commands to run without password

So as root (in /etc/rc.local) I want to run a script without root privileges say using su su - myuser -c myscript but in the myscript I want to run a command with sudo without giving a password. ...
1
vote
1answer
8k views

How to send sudo password in a shell script

My shell script (don't have EXPECT, and is not possible) runs a shell script impersonating another user. Let's say the following script is named toto1.sh and is run with a user called MYUSERNAME1. #!/...
1
vote
3answers
2k views

Debain(buster) su not working properly, command not found

For example: I installed ifconfig First i become root with "su" Now I write "ifconfig" and get: "command not found". I write "sudo ifconfig" and now it works. This seems to happen with a lot of ...
0
votes
0answers
217 views

How come a misconfigured /etc/resolv.conf affects su or ssh?

I have a Rhel 5 VM normally connected to an ldap service and today I discovered that ssh and su were broken. The shell would simply hang while trying either of these commands. I was only able to login ...
0
votes
0answers
290 views

How does one add shell parameters while executing commands with su?

The situation. I am debugging the environment of a restricted user who is relagated to a special shell. In order to do this, I need to run a command as that user in their full context using su like ...
4
votes
2answers
38k views

Switch user in Windows command line

Is there a similar Linux su command in Windows command line? If not, what about: in Powershell?; a workaround with a *.vbs script?; a workaround with some of the sysinternals tools like "psexec.exe"? ...
0
votes
1answer
855 views

How to start an interactive bash with su

I do not have sudo su over a username, however I have its password. I want to have an script that passes the password and gives me an interactive bash. I have tried this: echo mypassword | su - ...
0
votes
0answers
159 views

How to switch to other user of same uid?

I created 2 users with the same uid/gid. test:x:1000:1000::/home/test:/bin/sh test1:x:1000:1000::/home/test1:/bin/sh When I do su test1 and then whoami I get test How can I switch to user ...
1
vote
0answers
107 views

AD integration in RHEL 7 without Kerberos

How to integrate with AD in RHEL 7 without kerberos? I have below in /var/log/secure. Mar 12 09:57:31 xxxxxxxx su: pam_sss(su-l:auth): authentication failure; logname=admin uid=86500 euid=0 tty=pts/0 ...
55
votes
2answers
6k views

Where did the term “superuser” originate?

Where did the term "superuser" originate? Is it a shortening of "supervisory user", or is it just an indicator of the level of power one such user holds in a system?
0
votes
1answer
122 views

Block su without the '-'

I want to block everyone running su without the login option. They can run su - <user>, su -l <user>, su --login <user>. But su <user> will be blocked. How to achieve this?
0
votes
1answer
2k views

what does sudo su - s option means

I have used 'sudo su -' many times and I know what it does actually. I wanted to know what does this mean --> 'sudo su -s /bin/bash userid' I googled and iam not able to identify what i actually need....
3
votes
1answer
2k views

Rewrite a call to su-exec with su or similar?

In this bash script under Linux Alpine they have (line 8): exec su-exec "$ZOO_USER" "$0" "$@" As far as I know, su-exec is however an Apache httpd dependecy - can I avoid it installing it under ...
0
votes
0answers
84 views

screen command called from within a script, within a “su -c” command creates files on root directory

I'm executing this script from user root in directory "/": su -c "sh /home/bob/start_server.sh" bob and "start_server.sh" contains screen -d -m -S serverscreen mono startserver.exe However all the ...
0
votes
1answer
151 views

Script executed as other user from root creates files in wrong directory (root)

I'm running a bash script from a root perspective which then starts a program in the script su -c "sh /home/user2/script.sh" -m user2 The problem is that the program started by this script, while ...
1
vote
1answer
2k views

Plink is not switching user using su command

I am connecting to a server via plink as follows: plink -ssh -l username -pw password example.host.com -m C:\Putty\input.txt > C:\Putty\output.txt input.txt contains whoami su - newsuser whoami ...