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

learn more… | top users | synonyms

6
votes
3answers
657 views

Is it possible for root to execute a command as non-root

I am root user and suppose i want to run any application as another user. is it possible, without switching to another user. Something like # google-chrome user=abc I am actually executing a cli ...
2
votes
4answers
1k views

Accessing an exit code outside of a su -m $USER -c “<cmd>”

The below command prints "0" or "1" correctly depending on failure or not because i put $? inside the "su" command. sudo su -m $USER -c "./shutdown.sh &> /dev/null; echo \$?" However, if i ...
2
votes
2answers
151 views

gksu is a front end to su?

gksu manual page says that it is a front-end to su, however su doesn't need a command to be executed, while gksu does. Also, gksu doesn't seem to change the user ID of my shell, while su does. Is it ...
8
votes
2answers
3k views

Can't write to file /sys/class/backlight/acpi_video0/brightness (ubuntu)

I am trying to change the brightness by overwriting the value on this file: sudo echo 5 > /sys/class/backlight/acpi_video0/brightness -bash: /sys/class/backlight/acpi_video0/brightness: Permission ...
3
votes
2answers
1k views

Supply SU password in a bash script, within the script?

The purpose is to restart the machine if it doesn't get an abort command from the user. The problem is that the way the terminals are set up, user must supply SU password for shutdown, init, reboot, ...
14
votes
2answers
5k views

What's the difference between “su” with and without hyphen?

I'm quite new to Linux terminal and I'm not quite sure what the difference between su with a hyphen and su without a hyphen is, for example: su - username vs. su username. I looked into the ...
0
votes
1answer
160 views

Cannot use `su` or `sudo` after set up key-based access to SSH

I'm following this tuturial to setup key-based access to the SSH I created a user. I add copy the key to the client via ssh-copy-id <username>@<host> Becasuse ssh ...
2
votes
2answers
423 views

Is there a way to remove root requirements for a specific command in linux? If yes, how so?

I'm using Ubuntu 12.04 LTS, and I'm trying to make it so that the specific command dhclient doesn't require root privileges. I've done some research that leads me to believe I could unlock an "su" ...
1
vote
3answers
532 views

Use sudo command for script SSH server

I have to do following steps on several servers: log in with my username type in sudo su - type in amCLI -l 32/1 | grep Firmware So I would like to write this all in one script, my idea was: ...
0
votes
2answers
219 views

In Solaris how do you startup a script automatically without user input?

I'm using Oracle Solaris, and i would like to startup a script automatically everytime i turn on my computer and log into the desktop, however the script i want to run requires elevated permission, so ...
2
votes
3answers
5k views

Trouble setting up PATH for Java on Debian

I am trying to get Oracle Java 7 update 3 working correctly on Debian 6. I have downloaded and set up the files in /usr/java/jre1.7.0_03. I have also set the following two lines at the end of ...
1
vote
1answer
166 views

su - for some users

in a linux system with su - any user (with root password) can get root privileges. how I can restrict to some users ? // similar to AllowUsers in sshd_config
3
votes
1answer
2k views

Use su to switch to a local (mutually-trusted) user, without a password?

I'm curious if there is a way to enable one user to login (via su) into another user, without needing to know that users password. For instance, if I'm logged in as user1, I would like to give user2 ...
0
votes
1answer
183 views

sudo makes me “lose” permissions when running a script?

I have a script that I need to run. It is kicking off a java program. When I run it as me, it seems to work fine. If I type "sudo myscript.sh" it does not run fine. In reality, I need to run it as ...
2
votes
2answers
935 views

How can I automatically pass the password to 'su'?

I am working on an exploit for a security course. The object is to obtain a root shell in a linux virtual machine. So far, I can write to /etc/passwd and change root's password to an arbitrary string. ...
1
vote
1answer
1k views

How to get the env vars I want with the superuser command?

I'm running OpenSuse 12.1 KDE. I was previously running Ubuntu. In Ubuntu there was a superuser option (sudo -s) that preserved the original user's HOME env var (and another option, sudo -i, that set ...
2
votes
1answer
4k views

How can i block su access to some users only in linux

I want to configure pam in a way so that my some users can su to only some user. In RHEL4, I used /etc/pam.d/su auth required /lib/security/$ISA/pam_stack.so service=system-auth auth ...
1
vote
2answers
256 views

Best way to store root passwords

I have over ten web servers to manage and configure, with each server having its own root user and password. I have to maintain a database of all the root passwords on my development machine, but I ...
2
votes
1answer
226 views

Root authentication with another root user

I have a PC at work running Fedora 14. For some reason, the IT guys do not give out the password for the root user, but instead, if needed they create a specific suXXX user with root permissions. The ...
1
vote
1answer
320 views

Fedora 15 su user problem

I'm new to Fedora 15 and Linux. I've stumbled upon a problem while installing Oracle XE; I can't set environment variables or do anything else - any change I make won't stick. I'm using the terminal: ...
3
votes
1answer
2k views

What's the difference between sudo su - and sudo -i?

It is my understanding that they do the same: they ask for my password (if I am allowed in /etc/sudoers), and give me a login shell as root. Is there any difference between them? sudo su - sudo -i ...
0
votes
3answers
3k views

Linux PuTTY - automate su for password related issue

I am connecting to a server via PuTTY as follows: putty.exe -ssh user@host -pw password -noagent -m commands.txt After that I have to use: su someUser It will ask for a password - I have put ...
2
votes
3answers
1k views

How do I su to user login shell directly

I do the following many times a day I login to a server via ssh as user1, I then do su - to become root, then I do su --login user2 to become user2 Is there a way to tell su to go to user2 ...
1
vote
3answers
3k views

How can I find out what password I need to use for 'su'?

I am using Mac OS X 10.5, and have my account set up so that I don't need to login. When I go to Network Preferences and click the lock icon on the lower left corner, I am prompted for my username and ...
2
votes
3answers
13k views

Automating the “sudo su - user” command

I want to automate sudo su - user from a script. It should then ask for a password.
3
votes
6answers
2k views

a safer no password sudo?

Ok, here's my problem - Please don't yell at me for being insecure! :) This is on my host machine. I'm the only one using it so it's fairly safe, but I have a very complex password that is hard to ...
6
votes
3answers
1k views

use gnu screen when ssh'ed as a user, but su as another

Below is what happens when trying to use gnu screen. Essentially, it all works fine until I su as another user. then I get a Cannot open your terminal '/dev/pts/7' - please check. error l413:~$ ssh ...
0
votes
2answers
3k views

su Admin on Mac OS X does not work as expected

I'm tring to install PostgreSQL on Mac OS 10.6.4 and I need to authenticate as an administrator. In the command line, I have: su Admin Password: shell-init: error retrieving current ...
1
vote
2answers
3k views

What happens to the environment when you run “su -c”?

What happens to the environment when you run "su -c"? The reason I ask, is this mysterious behavior: bash$ which firefox /usr/local/bin/firefox bash$ su - user -c "echo $PATH" ...
3
votes
1answer
725 views

Problems with bash path when using 'su'

In Ubuntu Lucid Lynx, I'm trying to do su -l user -c "foo.sh args" where foo.sh is an executable bash script on the PATH set in ~user/.bashrc. Unfortunately, this fails because it can't find ...
21
votes
2answers
50k views

Command: sudo su -

I understand what su - does logs you into root with the root environment (as opposed to su which logs you into root with your environment) And I understand what sudo does you are root for one ...
2
votes
4answers
2k views

Any latest linux distro which gives full root access ( NO SUDO )?

Is there Any latest linux distro which gives full root access ( NO SUDO ) ? I want to use it for programming in which I have to use / file system very frequently. What I need is any good linux ...