Questions tagged [su]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

Create User and su in Dockerfile

Trying to create a new user foo with adduser --disabled-password --gecos "" smarthome I trie to su to that user su foo, what does not work (whoami is still root). I think that the ENTER is ...
curator's user avatar
0 votes
0 answers
42 views

sudo su and sudo -i-u dont work as expected [duplicate]

I am migrating one of our servers from centos 7 to ubutnu 22.4 lts Found an interesting issue: set /etc/security/limits.conf is set set with: * soft core unlimited * hard core unlimited created new ...
Ilia's user avatar
  • 101
1 vote
0 answers
207 views

Can't use `su` anymore nor use `sudo` after using `sudo apt-get upgrade` (Debian)

I'm having an issue right now. To set the scene : I'm currently working on a V2 for a Rails project, with more recent versions, gems, features etc, working with Nginx and Docker. In order to make it ...
Matthieu CORMELIER's user avatar
0 votes
0 answers
286 views

Debian 11: no root access anymore

After trying to reinstall my amd-gpu-drivers, my system rebooted into CLI. So I tried to reinstall GUI with "apt install task-gnome-desktop". After this my system says sudo is an unknown ...
wanna_b_noob's user avatar
1 vote
0 answers
493 views

RHEL 8.7 Server Unable to "su root" Consistently

This particular server was set up with the "French National Agency for the Security of Information Systems (ANSSI) BP-028 Enhanced Level" security profile that is packaged with RHEL. After ...
seanm's user avatar
  • 11
1 vote
2 answers
259 views

How to switch user to subuid running LXC container?

I'd like to either use su or sudo -u to switch users to the subuid created by LXC to run a container as unprivileged. Note: There is no username assigned to the UIDs in which containers are run. Due ...
Xylem's user avatar
  • 11
1 vote
1 answer
1k views

Sudo and su root not working

I want to use the sudo command but whenever I type it I see a message that says void is not in the sudoers file, this incident will be reported. I tried finding a way to fix it, and the told me to ...
Monetary gain's user avatar
0 votes
0 answers
56 views

These scripts work on their own but when I try to put them in on script it fails

So I need these in one script. The first operation must be run as super user to run and for the proper permissions, the second operation must be run as the current logged in user. The script gets to ...
tjernigan's user avatar
1 vote
2 answers
7k views

Getting "Error skipping startup message" when connecting with "sudo su" shell in WinSCP

My WinSCP config: File protocol: SCP user name: namjoo port: 22 settings > SCP/Shell > Shell: sudo su - When I try to connect I get this error: Error skipping startup message. Your shell is ...
Darwin's user avatar
  • 113
0 votes
1 answer
813 views

how to get to 'username' from 'username@server' on ubuntu terminal?

My terminal on ubuntu 20.04 looks like: I don't know what is @server after the username, but I guess it is a leftover from an earlier now meaningless installation of something. My question is how to ...
Sanyifejű's user avatar
0 votes
1 answer
86 views

Is there a .k5login equivalent on Windows?

Having obtained a Kerberos ticket, I can switch identities on Linux and BSD machines with su (or ksu), because the target account lists my main principal in its ~/.k5login. Can the same authorization ...
Mikhail T.'s user avatar
0 votes
1 answer
333 views

Super user binary source for Debian distro

I'm trying to craft a new root handle in a Debian distro and need to know where the source code for the su binary is located in order to move forward. Can anyone point me in the right direction?
Brandon Mccrary's user avatar
0 votes
3 answers
3k views

How can I switch to root on Ubuntu? NO sudo

Yes, I know sudo is a better way but this is a particular case where sudo isn't an option. On most Unix/Linux distributions this works by adding a user to a group (wheel, root) but I can't figure out ...
Sparky's user avatar
  • 1
0 votes
0 answers
180 views

su processes spawning with high CPU (Debian 9)

I am running a VM on Google Cloud with Debian 9. I should be the only user with access to the VM. Every so often the Web application I am running (phpbb) becomes very slow. When I log into to look at ...
badroit's user avatar
  • 161
2 votes
0 answers
6k views

sudo su - with error su: failed to execute /bin/bash: Permission denied

I have a Red Hat Enterprise Linux Server release 7.7. Local user created. Sudoers file configured with ALL = (ALL) ALL for the user. The user can execute any command, like: sudo ls, sudo cat, sudo ...
Alexandre Oliveira's user avatar
0 votes
1 answer
1k views

Is it possible to modify the '/bin/su' command so that it will allow root access without password and without checking command ownership?

I don't know well how the su command works. I know that sudo command must be owned by root for it to work. Is it possible to modify the su command so that it runs the root shell without asking for the ...
Codester Club's user avatar
0 votes
0 answers
742 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 ...
Johnson4996's user avatar
1 vote
1 answer
2k 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 ...
André Christoffer Andersen's user avatar
1 vote
2 answers
1k 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@...
Knecht Joseph's user avatar
0 votes
2 answers
149 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 ...
RNdev's user avatar
  • 101
0 votes
1 answer
64 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 ...
RobbyJC's user avatar
1 vote
0 answers
1k 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 ...
S.Chr's user avatar
  • 11
0 votes
0 answers
246 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 ...
vincent1890's user avatar
1 vote
1 answer
326 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 ...
Sean Patrick Floyd's user avatar
0 votes
1 answer
491 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 ...
Anjan Kumar's user avatar
0 votes
0 answers
429 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 ...
RatDon's user avatar
  • 127
0 votes
1 answer
518 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, ...
jlarks32's user avatar
  • 143
1 vote
0 answers
28 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 ...
Jo Shepherd's user avatar
0 votes
1 answer
1k 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 ...
j4nd3r53n's user avatar
  • 367
0 votes
1 answer
220 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([...
Andrew's user avatar
  • 165
0 votes
1 answer
967 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 ...
Kalam's user avatar
  • 1
8 votes
6 answers
6k 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: ...
Martin Prikryl's user avatar
0 votes
1 answer
142 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 (...
leetbacoon's user avatar
0 votes
1 answer
256 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) ...
Possi's user avatar
  • 21
0 votes
2 answers
973 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.
Frank Griffin's user avatar
0 votes
0 answers
1k 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 ...
RatDon's user avatar
  • 127
-1 votes
2 answers
6k 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 ...
Private61's user avatar
0 votes
1 answer
121 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 "...
AJP's user avatar
  • 253
0 votes
2 answers
4k 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 ...
AJP's user avatar
  • 253
1 vote
1 answer
686 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 ...
Dito's user avatar
  • 61
1 vote
1 answer
5k 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 ...
Tom Lous's user avatar
  • 113
1 vote
1 answer
1k 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 (...
Nick Bull's user avatar
  • 133
1 vote
0 answers
335 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 [...
UNIm95's user avatar
  • 125
3 votes
1 answer
422 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 ...
Martin Schmied's user avatar
1 vote
1 answer
664 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. ...
eskhool's user avatar
  • 193
4 votes
2 answers
24k 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. #!/...
ercey's user avatar
  • 41
2 votes
3 answers
3k 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 ...
James Greenland's user avatar
0 votes
0 answers
404 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 ...
Anil's user avatar
  • 1
0 votes
0 answers
533 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 ...
Rusty Weber's user avatar
9 votes
2 answers
165k 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"? ...
f4d0's user avatar
  • 223