Stack Exchange Network

Stack Exchange network consists of 175 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]

command for substituting user i.e. logging to a session as a different user.

3
votes
1answer
821 views

How can I install sudo without using su? [duplicate]

I need to use sudo but when I try to use it, a prompt tells me the command is not found and I need to install sudo. So when I switch to su so I can gain root access to install sudo, it says auth ...
0
votes
1answer
60 views

Using environment variables with su -c

I try to run nvm as a different user from a bash script. It is installed already and the NVM_DIR environment variable is set in /home/user/.bashrc: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ]...
0
votes
0answers
28 views

Can't login to root account

I restricted the use of su by creating an admin group sudo usermod -a -G admin "admin user" sudo dpkg-statoverride --update -add root admin 4750 /bin/su Later I regretted this so I removed the ...
0
votes
0answers
35 views

Restrict the use of su

I've restricted the use of su by creating an admin group sudo groupadd admin sudo usermod -a -G admin <YOUR ADMIN USERNAME> sudo dpkg-statoverride --update --add root admin 4750 /bin/su I've ...
0
votes
0answers
30 views

Not able to switch to root using sudo su and su command [duplicate]

Not able to switch to root using sudo su and su command: user@user-HP-Pro-3330-MT:/$ sudo su The program 'sudo' can be found in the following packages: * sudo * sudo-ldap Try: sudo apt install <...
0
votes
1answer
85 views

sudo is not installed, both sudo and su are not working

When trying to switch to root using sudo su : Error- sudo is not installed When trying to switch with su command: Error- this program is not installed $ cat /etc/os-release NAME="Ubuntu" VERSION="...
0
votes
1answer
190 views

Can not root: after removing ZSH and returning to default bash

I can not $ sudo su everytime, I enter the command, the terminal says : can not execute /usr/bin/zsh no such file or directory How to return to default bash of Ubuntu and make bash as default ...
0
votes
0answers
34 views

SOLVED Switching user in automated scripts like cron jobs

If I run su -c "notify-send test" myusername as root, the command will be executed by myusername (me). But if I place a script in /etc/cron.daily or /lib/systemd/system-sleep and it is ...
0
votes
0answers
110 views

change default username for SU command

I want to change the default for su command ... so when I use su (without username) it changes user to root but I want replace it with my desired username and not su default. I already checked pam....
0
votes
0answers
298 views

gpg: problem with the agent: Permission denied

GPG fails with gpg: problem with the agent: Permission denied when I invoke it after switching my user with su: su - user2 gpg --symmetric --passphrase foo foo.txt If I invoke the command from my ...
0
votes
1answer
32 views

I can login using su in other accounts, but not using login screen

When I try to login to my administrative account using Ubuntu's login screen, I cannot. However, I can access other accounts and log in to them. Additionally, I can login to my account using su ...
1
vote
1answer
67 views

Prompt has been changed after upgrade to 18.04.1 after using “su” to change user

Just updated to 18.04.1 I use Terminal only. When I do an su to one my users that runs a game, I only get a $ and no name of the user and does not show current location. Also, tab autocomplete ...
-1
votes
1answer
127 views

after su, the script stops working

we are running script the the first command in it is su (switch user) and after that other command: #!/bin/bash su sys_osrqa whoami pwd but when the script run, it asks for password, and after we ...
1
vote
1answer
125 views

Reset permissions on (K)Ubuntu 18.04: newly created user gets “Cannot execute /bin/bash: Permission denied”

so I seem to have screwed up some permissions on my Ubuntu desktop system. I wanted to let a newly created user only grant access to one single folder (to run in terminal only one app within that ...
0
votes
1answer
43 views

Cannot switch user - Error Code: 1

I'm in an interesting situation where I'm trying to log in to my headless Ubuntu instance in the cloud and I cannot switch to one of my users. Here's what I'm trying: login_id@cloud_machine:~> su ...
0
votes
0answers
18 views

sudo -i and sudo su - explained [duplicate]

Why are sudo -i and sudo su - equivalent? Why do they change to the root user without asking for a password whereas su - asks for the root password?
0
votes
0answers
34 views

su, non interactive, without password

I have user jenkins and anotherUser. I want to be able to execute a command from jenkins on anotherUser. When I run the following from the terminal it works as expected: su -c "bash /home/dev/...
0
votes
0answers
25 views

Troubleshoot local printer with journalctl command with elevated privileges

Since root passwd is disabled i can't invoke su -c 'journalctl -u cups.service --since="None" --until="2018-07-03"' > troubleshoot-logs.txt I'm looking for sudo analogue
0
votes
1answer
1k views

su: Authentication Failure, stopped working

I recently installed Ubuntu 18.04. I used su command, entered my accounts password. It worked successfully for few times. Then I got Authentication Failure, now I'm not sure if I entered wrong ...
0
votes
0answers
19 views

Can't sudo unless I su as another user and then su back to my account? [duplicate]

user@greeneyes:~$ sudo apt-get install xdotool user is not in the sudoers file. This incident will be reported. user@greeneyes:~$ su verelse Password: verelse@greeneyes:/home/user$ su user Password: ...
0
votes
1answer
214 views

Is it possible to run a command within a login shell using sudo or su?

I'm trying to run a non-interactive command within a login shell (using su - or sudo -i) but couldn't make it work so far. Within ~/.bashrc I have sourced a script which sets all variables my ...
1
vote
2answers
148 views

Set up sudo so that a particular common user can edit /etc/fstab

How can I set up sudo so that a particular common user can edit /etc/fstab? I've thought to edit /etc/sudoers.d file to do this, but how do we edit /etc/fstab in this file?
1
vote
1answer
34 views

After upgrade, rc.local now gives su must be ran from a terminal in rc.local

I have a few Ubuntu systems which use the su command from within the rc.local script. This updates a users git repo on the local machine, so its important that the ownership of files is kept to the ...
0
votes
1answer
2k views

writing a bash script that uses sudo [duplicate]

I am sure that this is a very basic question but I'm afraid that I have been unable to get it to work or understand what is going on. I have a node project that I usually run with sudo npm start ...
-1
votes
1answer
65 views

How can I access my files when I'm not logged in with my admin account (i.e. as a guest)? [duplicate]

I can no longer access my regular administrator account on my Ubuntu (see Ubuntu won't log me in with correct password) however I really need to access my files. I can only get on the PC with a ...
4
votes
1answer
1k views

Unable to enter superuser using su

Whenever I try to run su Password: Then it shows error setgid: Operation not permitted This problem arose after I changed permissions using chown Output of ls -lsa /bin/su is: 40 -rwxrwxr-x 1 ...
0
votes
1answer
130 views

Dell first boot failed, result in no session created

I just receive my brand new dell laptop wich is chiped with a pre-installed ubuntu-dell image. So I did the first boot to create my account and an "unrecoverable error" (or similar) occured and it ...
0
votes
1answer
832 views

How to alias pip to pip3 while using sudo for a specific user?

I have python2 and python3 both installed on Ubuntu 16.04, and use python3 primarily. I have both pip and python aliased to pip3 and python3, respectively, in my user's .bashrc. However, I had always ...
3
votes
2answers
2k views

How do I set environment variable for all users even when doing sudo su?

I created a file named x.sh in the directory /etc/profile.d/ so it should be accessible to all users. I expected when I change the current user in terminal (of logged-in user) using command sudo su ...
1
vote
1answer
178 views

Collecting user password via GUI in a script

I know that using the sudo and ssh tools it is possible to use GUI to ask for a password in a script by setting, respectively, the SUDO_ASKPASS and SSH_ASKPASS variables in which we specify a ...
0
votes
1answer
1k views

How do I become root when “su -i” is not supported? [duplicate]

As far as I know the following command is supposed to make me root: su -i Nevertheless, when I type it in Ubuntu 17.04 Zesty Zapus, I get the following message: su: invalid option -- 'i' Usage: su [...
-1
votes
1answer
504 views

How to run Ubuntu as normal user and switch to admin to change environment variables

I've just started learning Linux at uni, and my first homework is to: change current user to admin, do some stuff with environment variables, switch back to normal user I can normally log in ...
9
votes
2answers
2k views

Does sudo su create a child terminal?

This is what happened when I executed sudo su followed by exit $ sudo su # exit exit $ The exit command does not close my terminal emulator. Is it a child terminal?
0
votes
1answer
96 views

Changing wallpaper and language setting after su command?

Some time after su command I feel uncertain by seeing other wallpaper than the one corresponding to the new user. Is there any command usable at a batch, that I could use for quick switching that ...
0
votes
1answer
755 views

How to create service user for application and run it at startup from that user

I have an application, that I should run at startup. I created system user for that application with useradd -r serviceUser and made him the owner of application directory. Then I write startup ...
1
vote
2answers
59 views

Sudo and su simultaneously? [duplicate]

To switch between users sometimes sudo su newuser is used. What is meaning of sudo su together? Can anyone tell exactly how they both command together work?
6
votes
2answers
4k views

Best practices on using sudo in a bash script

I have a long and long-running bash script where a handful of commands need to be run as root while the majority of commands need to be run as the regular user before sudo, because it would mess up ...
9
votes
2answers
6k views

I can use sudo but I can't use su due to a password Authentication failure, shouldn't both be the same password? [duplicate]

when I try using a command with sudo everything works fine, however, if I want to log in as the superuser using su it doesn't let me. Why?
0
votes
1answer
276 views

could not enter to root directory

$ sudo su Cannot execute /bin/ksh: No such file or directory $ sudo chsh -s /bin/bash root Password: chsh: PAM: Authentication failure This also is not changing my directory; I could not enter ...
0
votes
1answer
1k views

Su without password [closed]

How can I do su from one user to another in same server without any password prompt for example su - xyz while in ABC user profile. Note:- I can't do sudo only su is required.
0
votes
1answer
229 views

Why su didn't work? [duplicate]

I'm new to ubuntu .. i tried to use su command to enter as a root but didn't work but i tried to use sudo -i , su root and sudo -s worked I need to know why su didn't work ?
1
vote
0answers
43 views

“alias android-disconnect=”fusermount -u /media/GalaxyNexus”

I dont think this is a big deal but it has been annoying me for the past month and im a newbie to linux and im learning it at the moment, everytime i do Sudo -i or Su "Username" it actually logs in ...
0
votes
1answer
769 views

error when typing su

when I run the command su it says: roger@RogerPC:/$ sudo su sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy' sudo: /usr/lib/sudo/sudoers.so must be only be writable by ...
0
votes
0answers
81 views

su to 'superuser system' fails even when root tries it, even after passwd setting

In order to minimise risk of fouling up the wife's machine, I have installed using her id, then created user userme, a guestlike user without sudoers privileges, and userME, a system user without ...
3
votes
0answers
1k views

Execute a command as another user by providing THEIR password

I need to execute a command as another user by providing THEIR password. This must be able to be done without a terminal aka purely through bash script. I also need to be able to do this without ...
2
votes
1answer
279 views

Why is su preserving SHELL=/bin/bash in this case?

I was experimenting with switching users with the su command. I'm confused why su carrying the SHELL environment variable over to a user monty. The exercise is shown below: vagrant@cats:/home$ cat /...
10
votes
5answers
6k views

Why doesn't the 'su' command work in Ubuntu but does in other Linux distros? [duplicate]

When I type the su command in a terminal I get su: Authentication failure Why doesn't this work in Ubuntu? I have tried this command in another Linux distro (Parrot OS) and it does work.
-1
votes
2answers
3k views

su without password with pam su-authentication

I've done the following configuration in ubuntu 14.04 but it's still asking password. $ /etc/passwd test:x:1004:1004::/home/test:/bin/bash $/etc/pam.d/su auth required pam_wheel.so group=...
0
votes
2answers
55 views

How do I restrict the users from installing applications from being installed on the linux machine?

How do I restrict the users from installing applications from being installed on the ubuntu linux machine? I have root privileges and there are three users in the ubuntu linux machine. I would like to ...
0
votes
2answers
58 views

If I only use when needed, does enabling the “su” account present dangers? [duplicate]

So I'm the only the user of my computer, and I eventually figured out how to enable the "su" user on my account with a password (really quite simple actually), just in case I ever needed to do ...