Questions tagged [su]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
29 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
21 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
21 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
12 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
51 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
34 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
67 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
955 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
28 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
101 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
0answers
13 views

How to pick password from property/variable/config for SU command

I want to switch user from other user. when i enter command to switch it is asking for the password. I want to avoid entering password manually, instead password should be pick from properties/config/...
0
votes
0answers
62 views

pam_unix on login identifies random wrong UID for user

We have a Linux debian9 server and we login via ssh as user 'admin' and then su to root. During 'su', UID identified and logged by pam_unix is random and wrong. [root@debian]# getent passwd admin ...
0
votes
2answers
26 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
95 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
153 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
21 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
598 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
274 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
2k 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
280 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
41 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 [...
2
votes
1answer
168 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
383 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
5k 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
181 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
222 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 ...
3
votes
2answers
16k 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
652 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
144 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
102 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
93 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
1k 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....
2
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
76 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
129 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 ...
0
votes
1answer
338 views

Difference between su user - and su - user

What is the difference between the two below? $ su user - and $ su - user
0
votes
1answer
464 views

Automate super user login in a shell script with password hardcoding

I need to log in to console as a super user through a shell script without typing password. Password should be hard coded to the script. ex- sudo su psadmin(psadmin is my username).
0
votes
1answer
88 views

Confirming behavior for “sudo su - someuser”

I am logged in as myuser. When doing su - someuser I need to give password for user someuser I tried this sudo su - someuser and I had to give only my password. My question is why didn't I have to ...
0
votes
1answer
2k views

How to run tinyproxy on centos7 without init.d?

All the tinyproxy "How-To" on the internet expect init.d to be reponsible for starting the tinyproxy daemon. But how to use tinyproxy on a recent, say cenotos7 machine, where traditional init scripts ...
1
vote
0answers
238 views

How to preserve SSH_CLIENT in `sudo su -`

I want to log commands executed by a user, part of that log is the originating IP address which is read from SSH_CLIENT. While it is possible to use env_keep += "SSH_CLIENT" in /etc/sudoers to make ...
0
votes
1answer
826 views

su in Debian chroot gives critical error (embedded system)

I'm trying to install Debian jessie inside a chroot on a embedded system (QNAP NAS with kernel 2.6.33.2). I successfully run debootstrap to install the base system and the chroot works correctly ...
0
votes
1answer
80 views

script which starts another script as another user, how to remove su process?

I have a bash script on Fedora Linux, which I run as root user, which starts another script as less privileged user rpmbuild. #!/bin/sh # start as another user, fork su rpmbuild -c ./long.sh & # ...
11
votes
1answer
14k views

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

Environment: OSX Sierra, Darwin Kernel Version 16.3.0 Root Problem: I want to use a bunch of shell scripts in a central repository, which have a #!/usr/bin/zsh. On my Mac, the zsh is in /bin/zsh. ...
2
votes
2answers
2k views

Shell and su command

Can someone please explain why when i issue: su echo $0 it says: bash when su - echo $0 it says: -su ? Am i right that in the 1-st case (just su) current shell spawns a new non-...
0
votes
1answer
83 views

Strange error with su - user

On a CentOS server, I can log in via ssh correctly, however; if I su - oracle I get su: incorrect password. I've changed the password and it continually says it's been updated. If I sudo su - and ...
3
votes
1answer
42 views

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

We have a system where we use different system accounts to control different environments. My standard flow looks like this: $ ssh server.example.com robin@server$ sudo su - env1-controller env1-...
0
votes
1answer
58 views

Switching users of same group in linux

My environment is like: I have two users 'user1' and 'user2' both are in same group (say group name is 'abc') in server 'server1'. Now I have another server 'server2' which have user 'user2'. User2 ...