3
votes
2answers
42 views

What makes the differences between `sudo CMD` and `sudo su` followed by `CMD`?

I have an SSH server with key only auth and I want to add a key for a new user. I log in with one user(kidmose), I try to append the key to a new user's(remote) authorized_keys and it fails: ...
2
votes
1answer
24 views

Check if Logged In via ssh or su

Let's say I'm called to a workstation and I face a console and I want to know if the current user logged in via ssh or su. How can I check that?
0
votes
0answers
23 views

Trying to rsync and use sudo on other end

Scenario: Mac OS X Machine - old computer - user: john.doe Mac OS X Machine - new computer - user: john.doe Goal: Copy /Users/john.doe/Desktop and /Users/john.doe/Documents via rsync Problem: ...
0
votes
1answer
121 views

Run startup script with another user

I have two users user1 and user2. And tomcat has owenership of user1 and started with user1 only. I need to make a rule for user2 such that user2 can starts/stop tomcat but tomcat should always be ...
0
votes
0answers
822 views

SU : Permission denied /bin/sh

I added a new user in system: $ useradd new_user When I try to switch from root to new_user, I get this error: $ su new_user permission denied /bin/sh $grep new_user /etc/passwd ...
0
votes
1answer
155 views

script to su with password in script without root

I have scripted a process that involves updating symbolic links on files located on 3 different machines. On those machines exists 4 users each, who each need to have these links updated. Using su, ...
1
vote
2answers
112 views

How do i run su username -c “command ” in a sequence

am trying to write a script that runs commands in a sequence as a user but su keeps doing every command at the same time instead of running them one after another the script looks like su username ...
0
votes
0answers
95 views

/etc/inittab combined with su - newuser failed to bringup new process with different UID than root

Using /etc/inittab on RHEL 6.3 x86_64 system, we tried to respawn a binary: aka watchdog from newuser UID login when restarted, not as a root UID process. Made the following changes as inline. ...
2
votes
1answer
435 views

Debian disable su to root user

I am currently using Debian 7 (Wheezy) and I am trying to disable the su command only when the target user is root and not a privileged user. For example, let's suppose the following users exist: ...
2
votes
1answer
322 views

“chmod -R 777 /” for a few seconds - now what?

On Centos 6.5 I accidentally typed chmod -R 777 / Ooops. I CTRL + C'ed out of it very quickly, but not before it'd started working away for a couple of seconds. Consequences? Well, already su ...
2
votes
3answers
3k views

How to login as root from Bash and do stuff

This is my simple bash: cat test.sh #!/bin/bash echo "hello" su - root -c /path/to/script.sh <<EOF password EOF whoami echo "good bye" But I get this error: ...
2
votes
1answer
216 views

difference between root executing command as sudo vs not using sudo?

I have a Linux question regarding the sudo command and the root user. If I log into the root user using the su command, what is the difference between the following two commands? root> sudo ...
9
votes
1answer
812 views

Debian - allow user to be root only for specific commands

We have several Linux boxes running Samba that are used 'locally', eg each branch gets their own Samba box to store and share files. The office managers need to be able to add and remove users for ...
4
votes
1answer
45 views

Why does cifs asks for su rights to write any data into it?

I'm mounting a windows share as follows: sudo mount -t cifs //192.168.178.49/public -o users,username=name,dom=domain,password=pword /mnt/nas Then I'm trying to create a simple file with some basic ...
1
vote
4answers
2k views

Alternative for sudo

I am aware that we can execute a command/script as a super/another user using sudo command. But Is there a possibility where the sudo utility itself is unavailable/removed by the user. If so, what ...
4
votes
1answer
88 views

Using su with commands

Ubuntu Server 12.04 On a remote server that I ssh into I have set up a special user with: sudo adduser --system --disabled-login --disabled-password --group suser to run some maintenance functions. ...
1
vote
1answer
1k views

su not working when non-root (authentification failure)

On a VPS I own (hosted at bluevm.com), I have three users: userone, with password foo, and sudo rights. usertwo, with password bar, without sudo rights. root, with now password (deleted with passwd ...
23
votes
3answers
2k views

Sudo su vs su linux

If I enter in the password to su when prompted, it doesnt work while sudo su does. Also, when a command is executed using sudo (command), does sudo automatically execute it by root by default (since ...
0
votes
1answer
271 views

Forgot su password at virtual machine?

I'm new to Fedora-17 and Linux. I've stumbled upon a problem after created my su password; I added some sequence and after this see prompt Setup is complete! But generally I didn't remember this ...
4
votes
4answers
154 views

Any differences between `su` vs. `su -` beside the pathing? [duplicate]

I see that su - makes the shell a login shell from su --help. I'm curious what the differences are between this and a normal su command. I know there seems to be a difference in the paths, any other ...
3
votes
2answers
491 views

SSH as Normal User --> SU --> SCP as Root

I'm on a Win7 box connecting to a linux server. From reading: http://winscp.net/eng/docs/faq_su it looks like I need to open my SCP connections as the particular user. When I connect via SSH, I can ...
1
vote
2answers
6k views

sudo to run command as different user

I am trying to setup a script that will be run as a "maint" user. The script is basically a menu that allows maintenance personnel to do different things on the server. However, some of the scripts ...
-1
votes
2answers
163 views

I can su to root, but sudo <command> fails

I am running Centos 5.3 and I can su to root fine. However when I run a command as another user like: sudo ls, the system says incorrect password for the same password. Why is this happening? Thanks. ...
0
votes
1answer
315 views

Difference between su command for Fedora and Ubuntu?

To log in as root while using Fedora I use : su and then enter the password. But while using Ubuntu this fails even if I use the correct password. But if I enter: su -s and then enter the ...
0
votes
0answers
57 views

Weird behavior of sudo

I use putty to log in to a remote LINUX machine. (Ubuntu 10) When I log in I have to authenticate myself, that goes on pretty smooth. Whenever I try to use sudo or su though, I experience ...
0
votes
2answers
159 views

su misbehaves when executing a command that prompts for a password

I have 2 users in my debian server, gooduser and root. Command my_cmd prompts for a password (it connects to a ssh server). When I execute my_cmd as gooduser, everything works as expected: ...
2
votes
2answers
2k views

sudo, runuser, su don't work as I expect when run as root with command as “echo $HOME”

When I run these commands it outputs as shown. /root $ sudo -u someuser -i "echo $HOME" /root $ runuser -l someuser -c "echo $HOME" /root $ su - someuser -c "echo $HOME" /root What i expected ...
0
votes
1answer
97 views

Configure environment after running su without hyphen

How would you go about setting up the correct environment variables and any other settings that should be set when using the su - username command, but without the hyphen? i.e. If I use su - ...
6
votes
3answers
727 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 ...
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 ...
15
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 ...
2
votes
2answers
459 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
551 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
6k 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
189 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
991 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 ...
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
14k 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 ...
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 ...