Skip to main content
52 votes
Accepted

Where did the term "superuser" originate?

Where did the term "superuser" originate? su allows one to become the super--user, who has all sorts of marvelous powers. From the First Edition Unix su man page: 11/3/...
DavidPostill's user avatar
  • 159k
35 votes

Where did the term "superuser" originate?

OED (paywalled) gives the following etymology: super- prefix + user n. The earliest example that they list is from K. Thompson & D. M. Ritchie (1971): "Unix Programmer's Man.": Only the ...
Jukka Suomela's user avatar
23 votes

Can't write to file /sys/class/backlight/acpi_video0/brightness (ubuntu)

As written in the Arch wiki (link), by default, only root can change the brightness by this method. To allow users in the video group to change the brightness, a udev rule such as the following can be ...
Manuel Schmitzberger's user avatar
21 votes
Accepted

How to create symbolic links in /usr/bin on a Mac?

You get this message because of Apple's System Integrity Protection. System Integrity Protection includes protection for these parts of the system: /System /usr /bin /sbin Apps that are pre-installed ...
13dimitar's user avatar
  • 819
16 votes

Difference between su -c and runuser -l -c

As already written in question comments, runuser is basically a su that doesn't use the PAM stack. To provide a little more detail, as per blog post of Dan Walsh - one of runuser authors - it seems ...
Radek Liska's user avatar
8 votes

What's the difference between "su" with and without hyphen?

Year 2022 update: It is discouraged shorthand for --login. See: https://man.archlinux.org/man/su.1#DESCRIPTION It is recommended to always use the --login option (instead of its shortcut -) to avoid ...
user124's user avatar
  • 191
4 votes

How to send sudo password in a shell script

If you have sudo available, the solution has already been posted in a number of places: echo <password> | sudo -S -u <user> <command> From man sudo: -S, --stdin ...
simlev's user avatar
  • 3,852
3 votes
Accepted

Executing command via sudo fails when multiple words

That's normal. Where su -c always passes the single string to a shell (it runs sh -c "echo hello" as root, and the shell parses the command), sudo does not do that – instead it directly ...
grawity_u1686's user avatar
3 votes

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

I don't know why I didn't try this earlier, but after I get Job 1, 'su - lfs' has stopped All I need to do is bring it to the foreground with fg. I don't exactly understand the "why" part of this, ...
Dito's user avatar
  • 61
3 votes

Plink is not switching user using su command

First, it does not work the way you think. The commands in the script are executed in sequence. The su (had it succeeded) would execute an interactive shell session and wait for user input (commands). ...
Martin Prikryl's user avatar
3 votes
Accepted

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

As colleagues at DevOps SE have pointed out, the proper usage of ´su´ should be: su -c "$0" "$ZOO_USER" "$@"
J. Doe's user avatar
  • 471
3 votes

Allowing automatic command execution as root on Linux using SSH

I believe an appropriate solution for a majority of simple cases [ ie if a framework like Puppet/Chef/CfEngine/Ansible is overkill ], but a high level of control of the remote system is required is to ...
davidgo's user avatar
  • 71.4k
2 votes

Shell and su command

When you using just su you inheriting environment of user that running su. In contrast, when you using su - (it is shortcut for -login option of su) it switching you "completely" to root's account and ...
Alex's user avatar
  • 6,255
2 votes
Accepted

Is there a way to tell which other users have switched to this user?

If everyone uses sudo you could consider using something along the lines ps -ax | grep sudo to see who is currently using sudo or env1-controller and by running who you could get an idea on who is ...
Seth's user avatar
  • 9,203
2 votes
Accepted

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

If you use the -m parameter with su, it will pass your current environment to the command or shell being executed. In particular, the $HOME variable will be set to its value in the calling shell and ...
AFH's user avatar
  • 17.7k
2 votes

Switch user in Windows command line

In Windows you have the runas command. Try this: Navigate to c:\windows\system32. Enter the following command: runas /user:computer_name\account_name explorer.exe
Lukas Germerott's user avatar
2 votes

Difference between su -c and runuser -l -c

runuser is not 'su without PAM' (at least, not in 2023). From the 2.37.2 manpage: The difference between the commands runuser and su is that runuser does not ask for a password (because it may be ...
Luke Yeager's user avatar
2 votes

How to send sudo password in a shell script

Approach 1 - Read from file You can save the password in a read-only file for the user and pass the contents to the sudo command. This will avoid password being stored in shell history # Save the ...
Sourabh Edake's user avatar
2 votes

Run CI command as non-root using su

Note, you can use sudo -u nonroot to run commands usually, but if you need to use su here's a way to pass the command and args without losing spaces and so on: su nonroot -c '"$@"' dummy &...
meuh's user avatar
  • 6,444
1 vote
Accepted

Running command via su as www-data user fails silently

su runs the given command indirectly – it calls the target user's default shell (the 7th "login shell" field in /etc/passwd) with the -c, <command> parameters. For example, when you run su ...
grawity_u1686's user avatar
1 vote
Accepted

Run command from sudo su

Probably the sudoers file on the remote side specifies the exact command you can run and it's su - serviceAccount. One or more additional options (like -c) will make the command not qualify. Any ...
Kamil Maciorowski's user avatar
1 vote
Accepted

su another user through ssh with a local script

tl;dr ssh root@"${DO_DROPLET_IP}" -i "${SSH_PRIVKEY_PATH}" \ 'su www -c "exec sh -s -- '"'${BB_USER}' '${APP_USER}'"'"' <"./server-user-setup.sh" Code injection possible via BB_USER and ...
Kamil Maciorowski's user avatar
1 vote
Accepted

LFS 8.2, cannot change user to root

I was already able to find the solution by myself. Firstly I tried to turn root's password off and then to use su again. I got the message "setgid: Operation not permitted". Then I found this question ...
Martin Schmied's user avatar
1 vote

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

If the required command is not within a block (eg loop or conditional), then you can split the script into three: the preceding commands run as myuser, the protected command run with sudo (which doesn'...
AFH's user avatar
  • 17.7k
1 vote

Shell and su command

Alex's answer is correct, but he hasn't really explained what you're seeing. When you run su - it's importing the environment of the user you are switching to (root in this case). The last command you ...
Darren's user avatar
  • 2,742
1 vote

Confirming behavior for "sudo su - someuser"

You are asked your own password because you are using sudo. And yes, su asks for the password of the target user when not called by root. See this question Which means that you could instead use a ...
xenoid's user avatar
  • 10.2k
1 vote
Accepted

How to run tinyproxy on centos7 without init.d?

Finally I can start the proxy with command: sudo su tinyproxy -s /bin/sh -c 'tinyproxy -d' or as a daemon with: sudo su tinyproxy -s /bin/sh -c tinyproxy Edit: Finally I found the right way: (...
dedek's user avatar
  • 101
1 vote
Accepted

su in Debian chroot gives critical error (embedded system)

After installing the same Debian jessie in another NAS with a newer kernel and seeing it worked, I managed to identify the culprit by comparing the files in /etc/pam.d/: it's pam_limits.so (inside the ...
virtualdj's user avatar
  • 276

Only top scored, non community-wiki answers of a minimum length are eligible