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
1
vote
1answer
32 views

Difference between su vs sudo [duplicate]

What is the difference between the two commands? Which one is better to emulate another user when wanting to do something as that user? sudo -H -iu USER command and su -l USER -c command
-2
votes
0answers
17 views

Kali linux installation

I installed kali linux (single boot), and it open in terminal and startx command not found. I cannot install packages because sudo command not found and su: authentication failed. Update: missing ...
0
votes
1answer
60 views

'su user' behavior differs when logged in locally vs via ssh

On my Ubuntu 18.04 system, there's a user called myuser without a password: tester@box:~$ passwd -S myuser myuser NP 03/31/2020 0 99999 7 -1 When I log in to the machine locally and switch to myuser ...
0
votes
2answers
28 views

How to solve the issue where nano screen text is scrambled when using su - admin

In Terminal I su - admin while in my user account to brew update, modify .bashrc, etc. I have noticed that when in my user session changing the size of the window while running nano doesn't scramble ...
0
votes
0answers
38 views

sudo -u “user” --login vs. su “user” --login

I think there is slightly differencess between sudo -u "user" --login and su "user" --login For instance, I create a user with useradd -m user and ran passwd -e which means the user user's ...
0
votes
0answers
26 views

`su -c “command” user` fails while command succeeds

this command fails when it is being run by a user that is different from myuser and having sudo rights: sudo su - -c "export KAFKA_OPTS=-Djava.security.auth.login.config=/etc/kafka/conf/kafka_jaas....
2
votes
1answer
110 views

How to install sudo, when I don't have sudo or su

I'm operating within a Kong API Gateway Docker container, and am trying to install some basic package handling. Ultimately, I need to be able to use sudo. The Docker image comes with only busybox bin ...
0
votes
1answer
27 views

Making wheel group membership sufficient for su on SLES 2015

I'm using SLES 2015. I want to make membership in the wheel group sufficient for root-privilege access via su. From Debian distributions, I'm used to uncommenting the command: auth sufficient ...
0
votes
1answer
50 views

Why is pam_env.conf ignored after I su into root user?

I'm trying to do: su -l and set environment variables like PAGER without success. How can I achieve this? This is what I have in /etc/pam.d/login: auth required pam_securetty.so auth ...
2
votes
1answer
61 views

Why does su ask for a password if stdin is redirected? How do I avoid this?

I'm using su (not interested in sudo for the purposes of this question) and observing the following behavior: $ su USER -s /bin/bash -c "echo hi" hi $ printf "" | su USER -s /bin/bash -c "echo hi" ...
0
votes
1answer
66 views

How to get the command line history of another user?

I currently have a server set up to save Bash history for every user immediately in their respective home folders and I want to create a script that runs on a set interval that switches the current ...
1
vote
1answer
105 views

Can a process send keystrokes or read text to/from a tty that is running su/sudo?

I need some information regarding the possible attack vector on *nix platforms of running su/sudo. Can an malicious process wait for the user to run su or sudo and then exploit that root access ...
0
votes
0answers
47 views

Getting strange error when trying to login through “su user”

When I'm login as root, all is fine, but when I'm trying to log in directly with user or "su username" command I'm getting this. Does anyone have thoughts about why this might happen? (1:43)# su ...
0
votes
1answer
39 views

How to copy file to another user (have password, no root)? [duplicate]

I am user_a and I have a password for user_b, so I can use su user_b to do things as user_b. I want to copy a file from user_a to user_b. I don't want other users besides user_a and user_b to see ...
0
votes
1answer
65 views

Why does su command ignore SIGSTOP?

After entering su when I prompted to enter a password: user@debian:~$ su Password: I can't send SIGSTOP (ctrl+Z) from my keyboard (the same terminal) - nothing happens. So the only way to exit is to ...
1
vote
1answer
87 views

Why does my su start in background?

When I use su - fred the job is immediately moved to the background. Then, if I use fg it works normally: wally@Machine:~$ su - fred Password: [1]+ Stopped su - fred wally@Machine:~$...
0
votes
0answers
35 views

Running commands with www-data privileges in scripts, crontab and systemd

I've already read "Allow www-data to perform specific commands" article. But, crontab and systemd invokes scripts using root privilege. # my-service.service [Unit] Description=My Service [Service] ...
0
votes
2answers
191 views

Why cannot I become root via `su`?

Why doesn't su work but sudo -i does? When I want to become root via su, the system doesn't accept my password, but via sudo -i it works. su: Authentication failure
1
vote
0answers
31 views

Solaris 11.4 RBAC works for vim, not for su

I want to access some commands as root, for a normal user. I create the profile profiles -p "privileged" set desc="privileged profile" add cmd=/bin/su set euid=0 end commit exit Then I add profile ...
0
votes
1answer
112 views

-bash: ifconfig: command not found when using `su - redbox -c 'ifconfig'`

I am logged in as root user and need to execute a single command from redbox user without switching. For this, I am using following command: # su - redbox -c 'CMD'. When I try to execute "ifconfig" (...
0
votes
0answers
87 views

su -c no such file or directory on Android 9 aarch64

I have a rooted android phone use Lineage OS 16 (based on android 9). Architecture is 64 bit. There is a file called andraxzsh which has the code su -c /data/data/com.mytestapp/APPS/bin/bash ...
1
vote
1answer
116 views

Debian 10 su command to existing user as root without password

I just installed a brand new VM with Debian 10 (buster) and joined it to our active directory using pbis. what I encountered now is, that: as the root user, I can su to every other available user ...
0
votes
1answer
77 views

Can't access some commands when logged in with non-root user (even after “su root”)

So, i don't understand whats happening here. I've set up a Debian 10.2 Server and configured like i did before with other Servers. Everything works fine, and because it's a local Machine and i am ...
1
vote
0answers
42 views

Differences between sudo chroot and chroot

I want to test chroot on my Linux machine. I try the following command: sudo chroot rootfs /bin/bash After that, I can run some commands that defined in rootfs, e.g., ls, mkdir, ... However, if my ...
0
votes
1answer
33 views

Can you run sudo -c and retain privileges?

Can you run su root -c "$some_command", and remain signed in as the root user, instead of dropping privileges immediately after executing the command (i.e. back out to the regular user)? In other ...
0
votes
1answer
31 views

Switching user with su db2inst1 prints sh-4.4$

I am trying to switch from the logged in user account to db2inst1 user account using the following command: su db2inst1 The command is executed without any warnings or errors, but instead of ...
0
votes
1answer
51 views

In FreeBSD, what flag or file designates 'root' and 'toor' as immediately logging in with su privilege without needing “su” after login?

Obviously it's widely recommended not to log in directly as a superuser account, but I'm curious. What is the flag or setting that FreeBSD uses to recognise those accounts that automatically gain ...
0
votes
1answer
50 views

Cannot loggin into root: failed to execute q: No such file or directory

So this morning I tried to login into my root and I got an error saying: su: failed to execute q: No such file or directory. In /etc/passwd everything seems to be normal. Tried logging in through: ...
0
votes
0answers
26 views

SSH tty session as a Here String

At my job, the only way that I can switch users is by doing the following: sudo su - *USER* In order to run multiple commands as the user (in a script or something), I use here strings and here docs:...
-1
votes
1answer
38 views

Restrict changing to root user

For security reasons my system boot with "guest" user or nobody. If that user run the "su root" command he will change to root user therefore gain access to all files owned by root. Since I can run ...
0
votes
1answer
33 views

Are there drawbacks (security or otherwise) to using 'su <user>' into a lesser-priveleged user to start a web application?

My goal is to manage the startup of a number of applications with an application executed by a user with elevated permissions. The plan is to have the startup manager (a node.js script using require('...
0
votes
0answers
30 views

Are there any substantive downsides to passwordless “su -l” over passwordless “sudo -i”?

Several years ago I discovered the use of <user|%group> ALL=(ALL) NOPASSWD: ALL in the sudoers file, which allows me to $ sudo -i # without ever being asked for a password. For home/...
1
vote
2answers
24 views

How to change user and keep current location?

I wonder how in one command I can switch to another user (in my case it is usually root) and still remain in the same location where I am before the change. I usually do it this way, unfortunately ...
-1
votes
1answer
42 views

do not source bash_profile or do not echo statements

In the ~/.bash_profile I have added some echo statement echo "omg!!" echo "$(date) welcome to $HOME" When I run command like sudo su - foo -c 'ls' Output: omg!! Thu Oct 3 13:44:41 IST 2019 ...
1
vote
3answers
492 views

Preventing users from sudo'ing to the root user

I'm searching for a way to prevent my system users to sudo into the root account in any way. I don't mean logging to the root user by SSH, but specifically by sudoing ( sudo -s ) ( sudo su ) etc. ...
0
votes
2answers
215 views

How to add variable to su - command bash

Im writing simple script, to be run by root, which needs to run some parametrized commands in other users behalf Eg in below sample I'd like to make dir with version taken from variable 'VER' But ...
1
vote
0answers
194 views

sudo and su do not work in a newly installed fedora 30

I just installed Fedora 30 and I am trying to get my head around it. I need to install lots of stuff from the command line but when I run sudo the system tells me that the command does not exist. (if ...
0
votes
1answer
60 views

Cannot use sudo with users that I added

add new user tom useradd -m -p 12345 -s /bin/bash -G wheel tom switch user from root to tom su tom and tom cannot use sudo, even I type right password. We trust you have received the usual ...
2
votes
2answers
215 views

Export command not found in su - user

Starting with root, I want execute a sql script with another $USER. But I have to set the right $ORACLE_HOME and $PATH for $USER. With this command I receive error export: command not found su - $...
20
votes
6answers
4k views

Why is su world executable?

I have a headless server that is logged into remotely by multiple users. None of the other users are in the sudoers file, so they cannot obtain root via sudo. However, since the permissions on su are -...
-1
votes
1answer
38 views

Make shell interpret operators enclosed in single-quotes [closed]

I have two commands built using the logical operator &&. The two commands are enclosed in single-quotes because they are to be passed as a command to root: $ su -c 'sed -i '1i TEXT' file1.txt ...
1
vote
1answer
123 views

Switching a user using “su” gives me only the $ prompt

I'm using Ubuntu 19 and I created a few users already. On the latest user I created and tried to do a: su userx I login with only the $ prompt, but when I type "bash" as that user I get: userx@...
0
votes
0answers
63 views

executing command as “su” is impossible

I am executing this command as su. I have made the connection with SSH (using sshNet), and then when I try to set the command su -, I get no response. I have the password and the command I would like ...
0
votes
0answers
553 views

Debian 10, su: Permission denied

As of right now, I create a brand new Google virtual machine. I upgraded the OS from Debian 9 (Jessie) to Debian 10 (Buster). For whatever reason, I cannot use superuser. Whenever I try, I get the ...
1
vote
1answer
242 views

stdout is accessible to user but not from su - user

I'm testing redirecting programs std_out to /dev/stdout in docker alpine. I can't figure out why I can echo from user to stdout, but not from su command. docker exec -it 779ddea6ec33 bash # root ...
1
vote
0answers
34 views

su - <username> isn't working, it was working earlier

I have Linux Centos 7 installed, Recently I created a user named oracle, when I ran su - oracle. It worked fine until an hour ago. Now, if I type su - oracle, nothing appears on the terminal, no ...
0
votes
0answers
5 views

vnc on alternate account fails

I run su -l work -c "vncserver :3 -geometry 1200x900 -name Work" to connect via vnc to my work account from my private account on the same machine. When running vncclient, it starts with just a black ...
1
vote
3answers
116 views

“su doesn’t record the commands executed as root”

I am currently reading book Unix and Linux system administration - Evi Nemeth. On page 70 under the topic "su: substitute user identity" there is a statement that says "su doesn’t record the commands ...
4
votes
3answers
409 views

Run script with arguments as user

I am trying to make sure when a script is run it is run as a specific user without having to su to that user before the script is run. Also the script is run with a couple of flags for example ./...
0
votes
0answers
19 views

Question about su and environment variable [duplicate]

From this question: How can I preserve an environment variable across su -? and from man I know that su - <other users> will: clears all environment variables except for TERM initializes the ...

1
2 3 4 5
9