Skip to main content

Questions tagged [su]

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

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

User added to wheel group, but can't su without password authentication

On a SLES 15 SP1 system, I've added a user to the wheel group: wheel:x:1003:joeuser however, when joeuser logs in as themselves, then tries to su (to become root), they are asked for their password. ...
einpoklum's user avatar
  • 10.1k
1 vote
0 answers
33 views

Processes launched from "su -" are not closed when killing terminal

I have a question regarding the processes launched via a SSH session, after having performed a su - user. My question applies to RHEL 8, but might as well to other O/S. The SSH connection is initiated ...
TontonS's user avatar
  • 11
1 vote
2 answers
1k views

Superuser and Sudo not working on Debian 12

I recently switched from Windows to Linux, more specifically to Debian 12. I'm struggling a bit because there are a lot of new things, like sudo. Anyway, I'm basically trying to put my regular user as ...
Sami Daniel's user avatar
0 votes
0 answers
48 views

is it problematic to disable 'session optional pam_systemd.so' in etc/pam.d/common-session/ to execute one line to speed up boot time?

At boot im running following command: su vis -c 'QT_QPA_PLATFORM=offscreen /usr/bin/browser --version' /usr/bin/browser being a custom browser, which cannot be run as root. The script that is ...
sir's user avatar
  • 1
-2 votes
2 answers
255 views

runuser: execute commands without use of quotation marks?

Overview I'm attempting to execute commands as a different user without using quotation marks as well as making sure the executed command isn't inheriting environment from the parent shell. runuser ...
GrabbenD's user avatar
  • 150
-2 votes
1 answer
182 views

Error in command su

I am creating a command that will change a certain line in the /etc/profile file from a script, however in certain versions of Linux the sudo command may not be activated so it would be necessary to ...
user avatar
0 votes
2 answers
67 views

My user account is no longer a su, and I don't know the root password. What are my options?

In Kubuntu 23.10, while updating my account photo in the System Settings > Users GUI, I must have accidentally changed my account type from Administrator to Standard, as I'm no longer a su. I guess ...
Jacob Stamm's user avatar
0 votes
1 answer
111 views

How to programmatically determine whether superuser elevation is necessary to invoke code?

When providing code to another, it appears to be good practice to remove all elevation-specific code — that is, provide apt update rather than sudo apt update (or su -c 'apt update'). However, this ...
RokeJulianLockhart's user avatar
0 votes
1 answer
1k views

Starting QEMU as another user

I'm currently trying to intercept/block specific requests from the guest in QEMU. According to this question, it seems that the easiest way to do so is to run QEMU as a different user, so that I can ...
Olmarq's user avatar
  • 3
0 votes
0 answers
41 views

I typed su <user> and my terminal didn't respond. Now I don't know how to exit, ctrl+D doesn't work

I didn't check if su was blocked so I directly typed su <user>, and then nothing happened except that it "loaded"... however, it didn't give me access to a new line, instead I'm stuck ...
christian ortiz's user avatar
0 votes
0 answers
134 views

sudo -i is behaving differently than sudo su -

If I as a non-root user (but in the sudoers file) do sudo -i, I get root privileges: laptop:~$ sudo -i [sudo] password for bjmgeek: laptop:~$ whoami root laptop:~$ id uid=0(root) gid=0(root) groups=0(...
Brian Minton's user avatar
0 votes
2 answers
607 views

What is the proper way to su as a local user from Udev?

When running commands related to displays, it seems that commands like xrandr don't work until they are run as a local user. However, when running scripts as a local user via a udev rule: SUBSYSTEM==&...
Chris's user avatar
  • 1,015
0 votes
0 answers
32 views

Why root user needs `sudo` to execute some commands [duplicate]

When I switched to root user using su command, I still need to use sudo reboot instead of reboot to reboot the system, otherwise bash returns bash: reboot: command not found Why is that the system ...
Yiyang Yan's user avatar
0 votes
2 answers
90 views

How does su detect fakeroot?

If I run su, it asks for the password of the target user. If i run it as root, it does not ask for a password. But if I run it in fakeroot, how is it possible that it will ask for a password? Should ...
jp_'s user avatar
  • 27
1 vote
1 answer
96 views

How to prompt "su" to re-request a password on an incorrect entry?

Default su behaviour : system@sword:/etc/pam.d$ su - test Password: su: Authentication failure <su exits> I need to configure "delay" when someone enters an incorrect password for ...
sword's user avatar
  • 11
7 votes
2 answers
5k views

Does "sudo" rely on "su" in any way?

I want to prevent the users from using the su command, and so I blocked the command in /etc/sudoers file as below: %group ALL=(ALL:ALL) NOPASSWD:!/bin/su But with this rule in sudoers, they are ...
Karthik's user avatar
  • 155
1 vote
2 answers
2k views

How to sudo to admin user after SFTP connection

I have a requirement to sudo to user 'admin' after connecting to SFTP server with below command. sftp user@hostname sftp> sudo su - admin Invalid command. Is there any other way I can use sudo?
user569136's user avatar
0 votes
1 answer
460 views

Allow multiple user groups to "su" to multiple other users without password

I want a specific group of users to be able to use the su command as a specific user. example) Group User allowsu_aa aa allowsu_bb bb allowsu_cc cc So I added the below to /etc/pam.d/su file. ...
genie4u's user avatar
0 votes
1 answer
199 views

Alias for the "su" Command

BASH SHELL; DEBIAN STRETCH As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I'...
Digger's user avatar
  • 405
-1 votes
2 answers
306 views

How does using sudo instead of su improve the security level?

Edit:: With the help of people, I realised I misunderstood the text and thought the creators Ubuntu also created sudo, which is not the case! So the question should be something like how forcing ...
jshji's user avatar
  • 143
0 votes
1 answer
31 views

variable contains $, expansion needed

The script fetches the path of a file via some command and then the mount command runs. pkgname= #defined here su -c "apkfile= #defined here &&\ stockapp=$(pm path $pkgname | sed -n '/...
decipher's user avatar
  • 322
-2 votes
1 answer
143 views

Having problems to become root

I'm trying to become root, a thing that worked perfectly some days away and now won't work. I type in the terminal su -sudo then the system ask me about the password, and then appears this message: ...
Feuergeist's user avatar
-2 votes
1 answer
258 views

How to setting Ubuntu sudo password dialog for every 1 hours [duplicate]

i work on my personal Desktop that no one touch it. so, i mean, duration password needs to be entered again after entering corect pasword. how to do that? thx
mobagenie's user avatar
5 votes
1 answer
1k views

How to make typing passwords visible? [duplicate]

When sudoing in terminal a user has to type password to gain root privileges. While typing what I am typing is not visible at all. I have mental disabilities so I often forget which character I was on ...
ding948952's user avatar
1 vote
1 answer
5k views

/usr/bin/id: cannot find name for user ID

When I am trying to su to a user I get errors that the names for associate group and user IDs cant be found. The when I id the same user (while logged in with it) it says no such user But when I id ...
Nullpointer's user avatar
0 votes
1 answer
183 views

Pass file descriptor through su -c

Given a file descriptor fd open in c program A, I want to start program B with fd open as U2. On my system (wsl2 ubuntu), execl("/usr/bin/su", "su", suarg1, "U2"); (where ...
user20524567's user avatar
0 votes
2 answers
1k views

How can I return to my user's home directory after becoming root?

How can I switch from user to root? In my terminal I typed in su - and it took me to the root directory, so I need to go back to the user directory.
YINMII's user avatar
  • 3
1 vote
1 answer
78 views

Sudo vs Su with specific usage on Debian

Are: sudo -i and su - functionally the same, both should give fresh root shells with root's environment right? If so are sudo -s and su the same? Thanks
Woodstock's user avatar
  • 418
0 votes
1 answer
512 views

Run two commands with the same argument, on one line

I need to parse a file line by line and pass a value found in them to 2 commands, in FreeBSD's sh (no other shells can be used). My plan was to use xargs and su: whatever_outputs_values | xargs -I {} ...
user548250's user avatar
1 vote
2 answers
15k views

I cannot access /root directory

I have Ubuntu installed in my Mac, not on VM but as a second OS. When I open my terminal, my username is ubuntu, instead of root. so it become ubuntu@nadia-ubuntu:/$ Then I try to get into root ...
Nadia Atika's user avatar
0 votes
1 answer
55 views

Allow users to passwordless su to more than one user

Assuming I want user1 to be able to passwordless su to someuser, I add to /etc/sudoers.d/custom user1 ALL=(someuser) NOPASSWD:ALL What is the syntax to also allow the same for anotheruser? Following ...
pkaramol's user avatar
  • 2,999
3 votes
2 answers
2k views

Why can't I su to root via ssh?

I've set up two VMs with exactly the same image (debian-11.3.0-amd64-netinst - headless). The only things I touched on these machines are: Root password Sysad password Installed sudo command Changed ...
frostgod's user avatar
0 votes
1 answer
593 views

sudo and su root broken

I cant seem to get either sudo to work or my root to work. i thought it was related to me changing the default shells or forgetting the root password but i rest the root password and changed the ...
Nic Tanghe's user avatar
0 votes
0 answers
188 views

How to switch from root to my unix user and solve (code .) command issue?

When I open ubuntu(wsl) on windows , usually, it opens as karim_123 user and not as root user. But this time it opened as a root user. How can I return back to my unix linux account(karim_123)? I used ...
Karim's user avatar
  • 1
1 vote
0 answers
1k views

command whoami and echo $USER are giving different outputs how is that even possible?

If I don't fix this I can't properly run bash scripts that checks whether the $USER is root in an IF statement, because, as it is, the $USER is never root, even when the whoami is the root. No matter ...
vcedraz-'s user avatar
2 votes
1 answer
404 views

Restrict User Functions to only "su" to other users

I have a server running on CentOS 7 that have 100 user each user with restricted access to its home dir. I want to create a user that only able to su to one of these other users, where all other ...
Eng7's user avatar
  • 1,691
0 votes
0 answers
71 views

su cannot find script in path

On AWS EC2 instance I have the following script that runs at startup under the root user cd /home/ec2-user/lutze su -p -c "python -m lutze" ec2-user The script runs without a problem ...
Eden's user avatar
  • 111
1 vote
0 answers
3k views

Fix dconf-WARNING **: failed to commit changes to dconf - in non-login su session

I've read this: dconf-WARNING **: failed to commit changes to dconf: The connection is closed ... and I have the same problem. But - I don't like the solution. I want to run a non-login root shell ...
einpoklum's user avatar
  • 10.1k
1 vote
1 answer
675 views

Errors when changing user

Every time I use su myName to change my user, I always get these 3 errors. -bash: zstyle: command not found -bash: autoload: command not found -bash: compinit: command not found It only happens when ...
Phill's user avatar
  • 11
0 votes
1 answer
1k views

useradd -p option [duplicate]

I can't understand the purpose of -p option in 'useradd' Let's create a user useradd -m -p 'pass1' user1 after running the command above, when trying to log in using su - user1 authentication fails....
mehrdad's user avatar
  • 65
0 votes
1 answer
514 views

Use "sudo su" but avoid having root as file owner

I have a long script which I want to execute, a lot of commands in the script need sudo. To avoid using sudo, I put sudo su at the beginning of the script. The problem with this is that this makes all ...
Kevin Holtkamp's user avatar
2 votes
1 answer
2k views

su: cannot set user id: Invalid argument

I'm trying to create a new user and enter into it, under my Linux SUSE SLSE12 machine. I'm root on that machine. The set of commands: > whoami root > useradd -u 123456 new_user > id new_user ...
vesii's user avatar
  • 223
0 votes
1 answer
382 views

Exporting environment variable to user after login via su

I am struggling to work out what exactly the following alias does. I guess it is making the environment variable COUNTER available to the user nobody but the COUNTER=${COUNTER} preceding the ssh and ...
Olumide's user avatar
  • 177
1 vote
0 answers
262 views

whoami command fails after running /bin/su

I have a system with an init script that launches multiple applications, each under it's right user and group. The init script checks the home directory of each user and looks for the application init ...
user2234234's user avatar
10 votes
1 answer
3k views

Why isn't a systemd user session started by `su`?

When I use ssh to log in to the root user on my server, an entry 0 is created in /var/run/user because pam_systemd tells systemd-logind to do this. This is an indicator that a user session has been ...
jrpear's user avatar
  • 444
0 votes
1 answer
150 views

curl pipe script forks a new Terminal window

I have a script which unexplainably forks a new Terminal instance on some Linux distributions... I'd rather it doesn't do this. Oddly, when I run the script directly (./install.sh) the additional ...
tresf's user avatar
  • 333
3 votes
0 answers
210 views

Alternative to "gksu" in "su" mode for non-root users

On an Oracle Linux 8 installation, I am trying to implement a desktop launcher for the GNOME shell where the (graphical) program is to be run as a different (non-root) user. However, I want to enforce ...
AdminBee's user avatar
  • 23.3k
0 votes
1 answer
786 views

" sudo su - " is switching the user but files are getting created with parent id

We have one bash command with one user "useradm" which runs a command as sudo su - platfrmapi; sh script.sh sudo su - platfrmapi; cp script.sh script_2.sh The user-switching is happening ...
Ravi's user avatar
  • 409
1 vote
1 answer
3k views

How do I login as the root user?

I installed Debian a day ago and I'm very new to Linux please forgive me if I miss something obvious but: whenever I use sudo command it asks me for the current user password but the current user ...
NightmareXD's user avatar
1 vote
1 answer
361 views

A question about sudo and pass the password to command

Most user said is easy to pass password for sudo command using this cli sudo -S <<< "yourpassord" yourcommand or echo "yourpassword|yourcommand Those cli works for a lot of ...
elbarna's user avatar
  • 13.2k

1
2 3 4 5
11