Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [su]

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

0
votes
0answers
24 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
44 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
29 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
402 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. #!/...
0
votes
1answer
141 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
60 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
150 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 ...
0
votes
1answer
1k 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
124 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
47 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
55 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
50 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
873 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....
0
votes
1answer
338 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
57 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
120 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
744 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
160 views

Difference between su user - and su - user

What is the difference between the two below? $ su user - and $ su - user
0
votes
1answer
333 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
71 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
1k 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 ...
0
votes
0answers
126 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
384 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
66 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 & # ...
8
votes
1answer
8k 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. ...
3
votes
2answers
1k 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
75 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 ...
4
votes
1answer
35 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
45 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 ...
0
votes
1answer
457 views

On Debian 8 Cinnamon doesn't start for my normal user. Only as root

I was using the OS and suddenly Cinnamon crashed. A modal window asked me if I would restart the desktop environment or not. I clicked no, for error... Now when I try to access (graphical login) with ...
1
vote
1answer
1k views

How do I su as normal user without password?

I was wondering if someone can help me with my script. I have 2 servers. Lets call them Server A and Server B. Server B has a software installed on it that I would like to run from Server A. I'm ...
1
vote
1answer
64 views

Change user in shell function?

I would like to change the user within a shell function. I guess its not possible to change the user in such a enclosed function, but is there another way to achieve something like that?: myFunction()...
0
votes
0answers
25 views

What's the difference between su calls [duplicate]

I can open a shell for a system user by calling sudo su - systemuser -s /bin/bash or sudo su -s /bin/bash systemuser What's the difference between those commands? They look pretty identical to me. ...
0
votes
1answer
61 views

Can SU group be used on Suse as it is AIX?

I'm the admin of a large AIX environment. I utilize the SU Group attribute for users to determine who can access root, even if they know the password. If they are not in the root group then access is ...
5
votes
1answer
3k views

Difference between su -c and runuser -l -c

I need to run some command lines as particular user in a shell script. I've found (at least) two way: su user -c 'command' runuser -l user -c 'command' Is there a significant difference between ...
0
votes
1answer
196 views

PID of commands run as different user

While being a root, I want to start a service as a specific user and write its PID file. Minimal nonworking example: if [ $UID -eq 0 ]; then su myuser <<EOF sleep 30 & echo $! >...
0
votes
1answer
331 views

Su doesn't work - Raspbian

I'm installing an OrangePi (more powerful than the Rasp one). After installing the system with the default root user only I would like to add a new user and connect from ssh adduser foobar I got all ...
0
votes
1answer
2k views

ubuntu 12.04 su fails : cannot execute /bin/bash no such file or directory

After adding a user as sudoers as, su to this user fails with error message: Cannot execute /bin/bash : No such file or directory I googled and found a lot of similar issue, mostly due to /...
0
votes
1answer
63 views

execute su with additional commands

I want do something like this: sudo su -l <user> cd <somedir> But whenever I give su additional arguments after 'user', the command returns instead of giving me an interactive shell.
1
vote
1answer
3k views

bash: /home/user/.bashrc: Permission denied when try to change user from root to user

I'm on centos, when I login as root and use su x to change user to x, it shows this: bash: /home/x/.bashrc: Permission denied I try to source ~/.bashrc but nothing changes and I also tried following ...
1
vote
0answers
95 views

How do I disable su on Macbook Yosemite?

I'm taking my macbook into the shop for service. I want to create an account that has no access to anything but its own user directory. In Yosemite, when I create a new account without administrator ...
2
votes
1answer
895 views

su - Automatically unlock ssh key

On Linux there exists a tool - I believe it is ssh-agent - that can automatically unlock one's ssh key, so that when using git to fetch from a remote repository it will automatically use ones unlocked ...
0
votes
1answer
365 views

Accidentally change sudo user to /bin/false

More Update In short, I have to execute a command (sudo nano /etc/passwd) using a Sudoer Account which I know the username and password but I have to login as a non-Sudoer Account trial #1 su - $...
2
votes
1answer
801 views

Auto source a script after sudo su

I am working on a machine that has some user accounts that are dynamically generated, and therefore I can not user customize the .bashrc or .profile. I frequently need to use these accounts to change ...
0
votes
1answer
511 views

Spawn command line prompt to a remote Windows machine

Is it possible in Win7, Win8.1, Server 2K8 and 2012 to "shadow" or rather spawn a console and 'impersonate' or 'masquerade' a user command line prompt ? I am domain admin and I would like to interact ...
1
vote
1answer
1k views

how write in script bash: su - user, command, password, without ask me password? [duplicate]

i will create file sh (bash script) #!/bin/bash su - username -c XXXXXXXX xxxxxx= command where i put my password?( but NOT ask me password in terminal..how?)
1
vote
2answers
696 views

how to create a user with root privilege and fix this error?

I created an user with root access useradd -ou 0 -g 0 myuser -p [12345] when I try to su to new user, it's show me : : No such file or directory when I want to connect to that via ssh it's show me ...
2
votes
1answer
122 views

What's the point to log in as root and do “su - user” instead of log in as user?

I have to redo a bash script (not originally written by me) and at some point there is an ssh connection with the user "root" and the first thing after that is : su - otheruser I don't really ...
1
vote
2answers
66 views

Running su noninteractively?

So, I got locked out of a server (sshd seems to have stopped responding). I got a reverse shell (added a jenkins job that gives me a reverse shell), but I've hit a snag - su wants a terminal, and ...