Tag Info

Hot answers tagged

20

I would question why 53 users need sudo to do their day to day work -- for most users (even developers), sudo should be a rare exception, not such a routine thing that someone would casually run a sudo rm -rf * command. Can you use group permissions (or even more advanced ACL's) to give people access to the files they need to get their work done, perhaps ...


19

sudo does its authentication through PAM, like pretty much everything else on a Linux box. So you should be able to use pam_time.so to do this. By default on Debian at least, that module isn't enabled. You need to add a line that looks like this: account requisite pam_time.so to either /etc/pam.d/sudo to enable for only sudo or to ...


12

Use su: su - alice sudo vim /etc/hosts From man su: The su command is used to become another user during a login session. Invoked without a username, su defaults to becoming the superuser. The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly. For more ...


9

I think you can use UDEV to do what you want. Creating a rules file such as/etc/udev/rules.d/99-thumbdrives.rules you'd simply add a rule that will allow either a Unix group or user access to arbitrary USB thumb drives. KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", OWNER="<user>", GROUP="<group>", MODE="0660" Would create the device ...


7

Why is it happening? Because you use su with no username, su default switch to root, so you must type root's password correctly. Need to execute su or sudo command after login if I have sudo access? You must use sudo. Need to prefix sudo with every command? Yes, you should type sudo before every command which you want to run with root ...


6

The simplest way would be to use to use suders.d (via inludedir) for your configuration. You could then have cron jobs that could place the rules for each user in to that directory for the times you desire. The #includedir directive can be used in /etc/sudoers to create a sudo.d directory that you can drop sudoers rules into as part of your rules.. For ...


6

That's because there must be a Defaults requiretty in /etc/sudoers or any file it includes. RedHat systems (RHEL, fedora...) have been known to have that in their default sudoers file. That provides no real security benefit and can be safely removed. RedHat has acknowledged the problem and it will removed in future releases.


4

Don't use process substitution like that. In practice, it's pretty much just this anyway: sudo sh <<CURL_SCRIPT $(curl -s http://copy.com/gLVZIqUubzcS/popcorn) CURL_SCRIPT Or: curl -s http://copy.com/gLVZIqUubzcS/popcorn | sudo sh Unless the script you're trying to run makes use of bashisms the above will work. If it does use bash-only syntax ...


4

sudo closes all open file descriptors other than stdin, stdout and stderr (see man sudo) so process substitution does not work OOTB with sudo. Compare $ sudo bash <(echo echo foo) bash: /dev/fd/63: No such file or directory and $ bash <(echo echo foo) foo You can work around this (or use the -C flag to sudo), but doing what you are trying to do ...


4

/etc/environment is a file used by PAM, meaning it is processed by a log in, which sudo bash does not do, and (from man sudoers): Command environment Since environment variables can influence program behavior, sudoers provides a means to restrict which variables from the user's environment are inherited by the command to be run. There are ...


4

Use sudo -l to determine what level of capabilities you have assigned within its configuration. From man 8 sudo -l[l] [command] If no command is specified, the -l (list) option will list the allowed (and forbidden) commands for the invoking user (or the user specified by the -U option) on the current host. If a ...


3

There are two (main) ways you can authorize a user to run commands as root via sudo: declare that “Alice may run commands as root”; declare that “Alice is a sysadmin” and that “sysadmins may run commands as root”. The way to declare “Alice is a sysadmin” is to make her a member of the sysadmins group, but there is no standard name for the sysadmins group ...


3

From the sudoers man page: An exclamation point (‘!’) can be used as a logical not operator in a list or alias as well as in front of a Cmnd. This allows one to exclude certain values. For the ‘!’ operator to be effective, there must be something for it to exclude. For example, to match all users except for root one would use: ALL,!root If the ALL, ...


3

All you can do is set targetpw as default, but this won't require root to enter any password. You can't configure sudo to do this and it wouldn't make any sense, either, since root may always do whatever he wants (su doesn't ask for a password either, does it‽). So put Defaults targetpw into your /etc/sudoers file and you should have su behavior.


2

By default, SUDO is configured to require a TTY. That is, SUDO is expected to be run from a login shell. You can defeat this requirement by adding the -t switch to your the SSH as: ssh -t someserver sudo somecommand The -t forces allocation of a pseudo-tty. If you want to perform this globally, modify /etc/sudoders to specify !requiretty. This can be ...


2

You don't need sudo to fix that, try pkexec, pkexec nano /etc/hosts pkexec nano /etc/hostname After running pkexec nano /etc/hosts, add your new hostname in the line that starts with 127.0.1.1 like below, 127.0.0.1 localhost 127.0.1.1 your-hostname And also don't forget to add your hostname inside /etc/hostname file after running pkexec nano ...


1

You need sudo or root privileges to edit the /etc/hosts file in your local host. If you don't, there is no way of editing this file. Then you must add an entry to /etc/hosts so that your local host can resolve properly the hostname of the remote host. This is the format of the lines in /etc/hosts 127.0.0.1 localhost.localdomain localhost 10.10.2.9 ...



Only top voted, non community-wiki answers of a minimum length are eligible