Hot answers tagged

5

The user executing the sudo command must also have execute permission to the file Statement 1 is not accurate. The user executing sudo does not need to have execute permissions on the script. Only the file will execute as root and not the commands within Statement 2 is also not accurate. All the commands in the script invoked by the sudo user ...


4

There are multiple ways to go about this. Here are a few: Disable the password prompts Ref: https://serverfault.com/questions/579296/how-do-i-disable-the-sudo-password-prompt) Alter the timeout Ref: Change default sudo password timeout Elevate to root sudo -i This latter option is the closest match to your question, I suppose, but you may well find ...


4

There will be a file in /etc/sudoers.d/ that provides the extra configuration to allow user1 the full access you're seeking.


3

The two statements The user executing the sudo command must also have execute permission to the file. Only the file will execute as root and not the commands within. Are completely wrong. In addition, shell scripts don't need execute. Execute only makes them easier to use, as then the #! at the top is used to determine the interpreter. However you ...


3

Try the following steps: Boot from Live media Mount the Mint image from disk Edit/correct /etc/group Reboot


3

Try reading /etc/group-. This is a backup file which should have the last saved configuration, so if you haven't made changes to user groups multiple times, the old information should be in here. If you have made other changes after, or the group information you need isn't present, I believe you are out of luck. In this case, recovering the past groups of a ...


3

Lynis expects /etc/sudoers.d to be unreadable by “others”, i.e. rwx[r-][w-][x-]---. If you run chmod 750 /etc/suders.d the warning will disappear. The information should have been logged in the Lynis log file...


2

On Linux systems, access to Docker is typically gated behind a docker group, which has write access to the Docker sockets: % stat /var/run/docker.sock File: /var/run/docker.sock Size: 0 Blocks: 0 IO Block: 4096 socket Device: 17h/23d Inode: 831 Links: 1 Access: (0660/srw-rw----) Uid: ( 0/ root) Gid: ( 999/ docker)...


2

sudo -s Will leave you as root, be careful


2

You could use --rcfile to tell bash to read your ps1.sh file instead of the service_user's .bashrc: sudo -i -u service_user bash --rcfile /home/me/ps1.sh The execution flow then will be something like sudo running bash -lc 'bash --rcfile /home/me/ps1.sh' as service_user. If you want to source the service_user's .bashrc, you can do so in the ps1.sh file. ...


1

From your last example, it looks like your non-root username is t. When you use ssh, scp or rsync and don't specify a remote username, the tools will assume that the remote username is the same as the local one. So the command in your first example: rsync -a --delete --stats -h wget 'olive:/tmp' could be written more explicitly as: rsync -a --delete --...


1

For some obscure reason the " had turned into a “ in my terminal. I have no idea where that happened as i never use that character myself. Thanks to icarus for the lead!


1

Another approach can be use the nohup command, that is delegated to run a command in backround and write the result to a file.


1

If the script is being run from crontab one option would be to run it from root's crontab (or the system one) so that sudo is no longer required.


1

As noted in the comments, your script is not executable by other users. So, as mentioned, change user ownership and group ownership, then mark it as executable : chown www-data:www-data /var/www/db_backup.sh && chmod +x /var/www/db_backup.sh . Regarding your second problem, it should be asked separately, but anyway, without knowing exactly what the ...


1

From the manpage: The reserved word ALL is a built-in alias that always causes a match to succeed. It can be used wherever one might otherwise use a Cmnd_Alias, User_Alias, Runas_Alias, or Host_Alias. So, depending on the context, it can be all commands, all users or groups, all users or groups, or all hosts. For instance: a group like ...


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