Questions tagged [su]

Substitute User command

Filter by
Sorted by
Tagged with
0 votes
2 answers
30 views

Replacement of "su - user -c command" in systemd unit

Having read that using su - as part of an ExecStart= (ExecStop=) in a systemd unit is a bad idea, I wonder what the proper replacement is. When using some vendor-supplied scripts or commands (where ...
0 votes
1 answer
104 views

su: failed to execute 1 sudo dpkg-reconfigure locales: No such file or directory

I was configuring a linux server and after an apt upgrade this message came up whenever I try to change the user to root. If I do sudo su -, su -, sudo -i I cannot change user because it says that su: ...
0 votes
1 answer
157 views

After run sudo and/or su or su - command, the command prompt not loaded, however the switch user is successful

I saw a maybe similar thread but not sure there the issue is the same: su command not responding? I have an Ubuntu 20.04 LTS baremetal server. After run sudo and/or su or su - command, the command ...
16 votes
3 answers
39k views

"Cannot set terminal process group" during su to another user as login shell

Note: Please read the updated information starting with "EDIT" near the halfway point of this post - the environment and background of this problem has changed I've got a bog standard Debian 6.0 ...
3 votes
0 answers
418 views

Unable to su or ssh as anyone but root on CentOS 7

I seem to be unable to ssh or su as a local user on my CentOS 7 machine as of today. $ adduser ndejay $ passwd ndejay Changing password for user ndejay. New password: Retype new password: $ su ndejay ...
-1 votes
3 answers
1k views

"su" does not work on FreeBSD

Below I sun "su" command on FreeBSD: FreeBSD rand.vstyle.local 9.0-RELEASE FreeBSD 9.0-RELEASE #0 amd64 This is server RAND :) [svn@rand ~]$ su logostudiotest1 /bin/ls Password: /bin/ls: /bin/ls: ...
3 votes
2 answers
4k views

can't login as root on a remote Redhat Server

I am currently working on a remote RedHat server(RHEL version 6.7 x86_64). I can login as a user by using userID and password which is provided by the server administrator. But when I try to login as ...
1 vote
4 answers
4k views

Execute root commands through ssh user

my goal is to execute commands as root user from another linux host through ssh. The Problem is: The environment doesnt allow to access the root user directly. The manual way, which works, is to ...
116 votes
8 answers
170k views

How to run command as user who has /usr/sbin/nologin as Shell?

All I need to do is to run a specific script as a particular user who does have the nologin/false shell indicated in /etc/passwd. I would run the script as root and this should run as another user. ...
0 votes
1 answer
3k views

Can't su to login on other user

I have a Debian server, and I can SSH to it.. On SSH there I'm prompted to specify username and pass, I can login here as any user I want.. If I'm root I can change to other users, for example with: "...
8 votes
2 answers
14k views

How to switch user given a UID?

I only know the UID of a user, is it possible to switch user using UID in linux distribution like we do using username like su -u someuser?
1 vote
3 answers
3k views

Ubuntu 20.04: su command bash-autocomplete stopped working

I am using Ubuntu 20.04. The su autocomplete stopped working. For example when I type: su TabTab It lists the files and directories of the current directory, where as it should list the available ...
0 votes
1 answer
1k views

Centos : su: incorrect password after bash update

A few days ago I've updated the bash to patch it agains Shellshock and since then I cannot su - root from my regular 'wheelgroupuser' account on Centos 6.5 with WHM. I'm constantly getting su: ...
0 votes
2 answers
488 views

Switching to a "role" account, using `sudo` and `ssh` agent forwarding later on – possible?

I want to create "role" accounts for several admin tasks that don't usually require root permissions. For example, consider a www-admin user maintaining files in /var/www. It seems to me that this is ...
1 vote
2 answers
415 views

How do I run sudo commands with a system user?

I want to run a minecraft server in Docker, so I started following this guide. In the guide, it is advised to create a system user with a home directory (/opt/minecraft), but without a password (you ...
1 vote
2 answers
1k views

su: authentication failure (password correct, setup worked before, nothing changed)

Most of the issues I found are related to new installs, root password being disabled by default, or things falling apart after some changes. None of that applies here: in my case nothing was changed, ...
1 vote
1 answer
723 views

Can't run command under /bin/false user

Centos 8. There is snowuser: [snowuser@snowcannon-01 ~]$ cat /etc/passwd | grep snowuser snowuser:x:1002:1002::/home/snowuser:/bin/bash [snowuser@snowcannon-01 ~]$ groups snowuser wheel There ...
3 votes
0 answers
408 views

Why su command takes to long in nested Debian LXD containers?

I observed that the command su takes too long (30 seconds) when it is executed in a LXD Debian container that is nested into an Ubuntu LXD container. This overhead does not occur Debian containers ...
0 votes
0 answers
529 views

Tenable su+sudo and selinux

My Not-A-Sysadmin-Boss wants me to explain this but I can't really find an answer? When using TENABLE SC to scan a RHEL7 system the account used to do the scan connects via ssh then uses sudo to ...
0 votes
1 answer
1k views

How to restrict users switching from su command

How can I restrict users switching by su command? Suppose there are 3 users (root,user1 and user2) only root and user1 can switch by using su command. root or user1 should not be able to switch to ...
1 vote
2 answers
2k views

Running su with -c gives unrecognized command error

I am trying to run a command as another user in Linux. Here is what I run: su user1 -c '/bin/mkdir /tmp/zz' However, this gives me this error: fatal: unrecognized command '/bin/mkdir /tmp/zz'
0 votes
2 answers
2k views

Why does "su - X" require password, but "sudo -u X bash" doesn't?

I know "why" questions are dangerous :) I have sudo access on RHEL, and noticed this: su - fred Password: (I don't know fred's password). sudo -u fred bash [fred] $ Is there a way to not ...
20 votes
2 answers
62k views

sudo rejects password that is correct

sudo (Which I have configured to ask for a password) is rejecting my password (as if I mis-typed it) I am absolutely not typing it incorrectly. I have changed the password temporarily to alphabetic ...
0 votes
1 answer
125 views

Let one user become another user without a password?

On (most) Linux systems, we can let a specific user su into anyone they want by placing him in the wheel group and making some settings in /etc/pam.d/su. I want to do something more limited: I want to ...
8 votes
4 answers
16k views

Can I sudo a command on behalf of another user?

I'm using drupal and Aegir. Aegir automates many tasks of site creation. Aegir has control of Apache, I'm logen in as root, and I want to restart the Apache server, but I want to do it on Aegirs ...
0 votes
1 answer
256 views

Having trouble switching to user using the "su - lfs" command

I am trying to do linux from scratch. I was able to create the user to manage everything (named lfs) and I was able to login using this command. I then powercycled my computer and I am no longer able ...
-2 votes
2 answers
62 views

How to protect from coworkers [closed]

Hello how to protect linux account form other administrators(coworkers) in company who can use your account to steal data and point a police that you are the guy who steal data from company. if ...
0 votes
0 answers
1k views

Can not su - root. su: incorrect password

I am trying to switch to root user using the su command. I am getting the following error $ su - root Password: su: incorrect password I checked the /var/log/messages and found the following: ...
1 vote
1 answer
245 views

Is this user root or not

I see the following in /var/log/auth.log (system is current Ubuntu). myserver su[14993]: illegal option minimum_uid=1000 myserver su[14993]: Successful su for jeanbon by root myserver su[14993]: + ???...
4 votes
7 answers
53k views

run script as another user from a root script with no tty stdin

Using CentOs, I want to run a script as user 'training' as a system service. I use daemontools to monitor the process, which needs a launcher script that is run as root and has no tty standard in. ...
1 vote
0 answers
288 views

Create a screen. Run said screen as a user. Detach

I'm essentially trying to combo Create screen and run command without attaching and another answer that allowed me to run a script as another user. I want to SSH from Server 1 -> Server 2 and run a ...
1 vote
1 answer
2k views

pam_tally2 incrememts before password for su attempts

There is a similar behavior here but I believe this is a different underlying cause, or at least requires a different solution since this failure isn't due to SSH keys. Our company is undergoing a ...
56 votes
1 answer
171k views

What's the difference between sudo su - postgres and sudo -u postgres?

PostgreSQL users peer authentication on unix sockets by default, where the unix user must be the same as the PostgreSQL user. So people frequently use su or sudo to become the postgres superuser. I ...
0 votes
0 answers
320 views

Can you disable su for certain users logged in via ssh?

Basically, I'm running a Mac Mini as a server, and I'm trying to close some security holes. My server has 3 users: admin, git, and server. Each user has public key authentication enabled, while only ...
0 votes
1 answer
2k views

Sudo not working. How to reset root password Ec2 (AWS)

I installed a SSL certificated the day before. Today I wanted to log in to the server. When I try to "sudo" it gives me the following error message: sudo: unable to stat /etc/sudoers: No such file or ...
39 votes
4 answers
109k views

BASH Scripting, su to www-data for single command

I am working on automating the creation of subversion repositories and associated websites as described in this blog post I wrote. I am running into issues right around the part where I su to the www-...
-1 votes
1 answer
2k views

Allow winscp access, restrict direct shell access, allow su - for Linux server local user

Is it possible to restrict access for a particular local user in Linux, with below mentioned conditions: User should have no direct shell access User should be able to login with command "su -" from ...
65 votes
2 answers
70k views

Executing a command as a nologin user

I've recently set up my server so that my suPHP 'virtual' users can't be logged into by using this article My issue now is that before when I ran a rake command for my Ruby on Rails application ...
0 votes
3 answers
1k views

Logout root after tmux detach

I'm running tmux on my servers and when configuring things I like to just su into root and take care of things. Is there a possibilty to log out root automatically after I detach the tmux session?
-4 votes
2 answers
2k views

Restricting su access

I am using rhel7.2 in our envirement.I do not want any user on system to "su" to 2 specific users say "user3 and user4".But "user3 and user4" can "su" to any user in the system. Let me explain my ...
1 vote
3 answers
22k views

Running a command a different user using `su` gives "standard in must be a tty"

I am using STAF to automate db2 interface testing with our product. I am able to run the command using su - db2inst1 -c "/home/db2inst1/sqllib/bin/db2 list database directory" but when I try the same ...
1 vote
0 answers
6k views

su: cannot set groups: Operation not permitted

I'm trying to get root access for a user who is initially logged in from a console. I have root access from another method. User does not have a username, so sudo is not an option. Running su returns ...
5 votes
3 answers
4k views

SSH: su root or sudo? [duplicate]

What is the better option: Using su to switch to root or enabeling sudo? Without the use of sudo an intruder would need to know the password (or key) of a user allowed to ssh and then also the root ...
0 votes
1 answer
279 views

User login without passwords

We have multiple users accounts with /bin/bash shell allocated to them. An another application "su" to these accounts for controlling their service statuses and monitoring purposes. Passwords for ...
0 votes
1 answer
1k views

RHEL7 - su - command error logging location

I am trying to understand if there is any logging happening for this command in any log file: $ su - user1 su: user user1 does not exist I checked /var/log/messages, /var/log/secure and /var/log/...
10 votes
9 answers
40k views

Disable su on machine

Is there a way to allow su only for specified users (like using visudo for sudo). The reason for this is I'd like to keep a simple (weak) password for my root account and have accounts that can su/...
5 votes
1 answer
8k views

How to automatically switch to home directory when switching user?

When i ssh to my ubuntu server, i get logged in to my user's home folder. But when i do su otheruser and enter the password, i get logged in as the otheruser but the home directory stays for the ...
1 vote
1 answer
691 views

Reverse a command and disable su on Ubuntu

Whilst following an online guide on how to secure Ubuntu server, I ran this command on one of my test VM's. sudo dpkg-statoverride --update --add root admin 4750 /bin/su I know the intention of the ...
41 votes
2 answers
33k views

Run command as Linux "system" user (shell = /bin/false)

I created a "system" user in Ubuntu 11.04 (adduser --system) for running certain cron jobs, but sometimes I want to test things out by manually running commands as that user. What's the easiest way to ...
102 votes
11 answers
114k views

How to prevent a user from login in, but allow "su - user" in Linux?

How do you allow a user to log in using "su - user" but prevent the user from login in using SSH? I tried to set the shell to /bin/false but the when I try to su it doesn't work. Are there several ...