7
votes
1answer
196 views

Linux/Unix - /etc/sudoers - host definition

can anybody tell me in which case the sudo host definition is useful? I mean this part of a line in the sudoers file: bob host1 = NOPASSWD: reboot In which environment (except sudo via LDAP) do I ...
-1
votes
2answers
51 views

Security in users having sudo access

How to protect my passwords list (in different databases for example) in a UNIX environment where most of the users have sudo access to other user IDs? I have a script (main.sh) with the following ...
22
votes
5answers
2k views

Can a program tell it is being run under sudo?

I have a program that should behave differently if it is being run under "sudo". Is there a way it can find out if it was run under sudo? Update: Someone asked why would I want to do this. In this ...
4
votes
1answer
416 views

sudo: How to allow only one argument to a command?

I want to add an entry to my suoders to allow one user to run a command with exactly one non-option argument. # tail -1 /etc/sudoers ALL ALL = (:tool) NOPASSWD: /bin/echo [a-z]* $ sudo -g tool ...
0
votes
2answers
286 views

CentOS lost Root Access

For some reason I cannot access my root user via SSH. It displays the error on login: could not open session. However I happen to have another user account that is a normal non-sudo user. Is there ...
-1
votes
1answer
69 views

running script containing sudo in cron [duplicate]

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
1
vote
1answer
111 views

sudoers entries

Is there a way to have a sudoers entry that allows executing of only a particular command, without any extra arguments? I can't seem to find a resource that describes how command matching works with ...
0
votes
1answer
279 views

Unable to change user password on AWS using `passwd` command

I am using Amazon's AWS insances running CentOS. I was trying to create a user with SUDO privilege and then disable the Root login to secure the systems. I have already done the required to bring this ...
1
vote
4answers
660 views

Is sudo command restriction in /etc/sudoers secure?

I try to restrict a backup daemon's user (that needs root access to client machines) so that it can only use the one command it needs. Thus, in /etc/sudoers, I use daemonuser ALL=NOPASSWD: ...
6
votes
2answers
882 views

Why can the root user edit read-only files, but a regular user with sudo access can't?

If you try to append to a file with no write permissions (say, the /etc/sudoers file which is is owned by root and has 0440 permissions), if you're the actual root user, this works. However, if you're ...
1
vote
2answers
600 views

Visudo All Password Less Access to Script (Visudo + Cron)

I want my user 'dave' to be able to run a bash script without entering a password, so the script can run with crontab? For all other activities I'd like this user to be required to enter a password ...
0
votes
1answer
643 views

Change primary group with sudo (-u) -g

I would like to run commands on an AIX system with sudo -i instead of just sudo. This way I can make sure that any environment settings like umask will be those of the user I'm running the command as. ...
1
vote
3answers
263 views

UNIX User Account to Restricted SysAdmin (User/Printer Admin only)

I'd like to know if there is a way for a user account to be enabled or elevated to carry out system admin tasks WITHOUT having to use the root account or sudo. Goal here is to allow a user account to ...
5
votes
2answers
3k views

should use sudo or just su root in server management?

Which approach is better? For desktop usage, it seems that sudo is better since: I can have a more consistent history as a normal user Don't need to remember two passwords, which is especially ...
3
votes
1answer
226 views

Flexible sudo access

I want to be able to give a user on a system I administrate the ability to access file X, using command Y using sudo. Is there a way to do this while allowing some flexibility over the arguments to ...
0
votes
4answers
499 views

To understand sudo and “.”

I am reading MySQL's manuals. They suggest me that the command cd /usr/local/mysql sudo ./bin/mysqld_safe // it seems that sudo = . + master rights is the same as . ...
3
votes
8answers
3k views

Linux - use “su -” but keep the current directory

When I do su - to get to root, my current directory is set to root's home. Is there anyway to keep the current directory that I was in, much like sudo -s. Or is the answer to use sudo?
35
votes
2answers
4k views

Why do I have to edit /etc/sudoers with visudo?

I've noticed that the sudoers file and cron config files act in a special way compared to other config files on Linux. They need to be edited with a special wrapper rather than any text editor. Why is ...