Step 1 – Access and login into your web server via SSH.
This will unload your env and load the one of root, avoiding to use bad env variable from your account with root. sudo -u www-data /bin/rm -rf /var/www/log/upload. When you remove the -u testuser, the command will run as root (as default) (without password for the testuser) and will create the directory. If you want to be able to switch to any user just use. This behavior can be modified via the NOPASSWD tag. * as archemar without password. NOPASSWD and PASSWD By default, sudo requires that a user authenticate him or herself before running a command. * won't work (will ask a password) as rm differ from /bin/rm. Further steps may be required to lock down the account, but without knowing your exact situation, I cannot advise further. For any reasons, if you want to allow a user to run a particular command without giving the sudo password, you need to add that command in sudoers file. I need that a new user could execute sudo without any request of password, because this user has in crontab a .sh that uses sudo for some commands.. It's part of the default sudo specification and is portable across all platforms, as specified in the OP.
Be sure to edit /etc/sudoers using visudo command. Ensure the … $ sudo visudo Append the following entry to run ALL command without a password for a user named marlena: marlena ALL=(ALL) NOPASSWD:ALL. Check it in /etc/passwd, 2) Unable to go to /root : check the rights of that folder, and if needed chmod u+x it, 3) In sudo mode that's pretty normal, 4) It's related to 1) As I wrote, that's only suggestions. Provide password inside the script, by running your sudo command like this: sudo -S <<< "password" command Note: This is a security risk too. If there are multiple matching entries in /etc/sudoers, sudo uses the last one.Therefore, if you can execute any command with a password prompt, and you want to be able to execute a particular command without a password prompt, you need the exception last. Sudo is well known for its ability to provide very limited scope superuser privileges to otherwise normal users on Unix systems. Step 2 – Run the following command on your server’s SSH terminal. # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) NOPASSWD: ALL Otherwise the group policy will overwrite your user policy and you will be asked for the password. Enabling passwordless sudo allows you to run Simulink models on Raspberry Pi without providing a password.