I want to make a sudoless passwordless script which doesn't prompt for password to any user executing that script.
Problem: my script contains rsync
utility to send files to a backup server, but i always get permission denied error
when the folder which needs to be send contains some files for which the access
is set to none. whereas other files are also owned by root but their access
is set to read only. I'm using public key authentication to send files to destination/backup so that it doesn't prompt for password input but it cannot send access protected files like above without sudo and password input.
Tries: I tried https://unix.stackexchange.com/a/229653/332764 this solution but it is not working. Still same error is there.
EDIT: sudoers file
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
ortega ALL=(ALL) NOPASSWD: /home/usr/path/transmit_ckpnt.sh
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
sudo
, but without requiring a password. When you tested it, did you usesudo
?root
access, then I don't think it's possible, I encountered same problem some time ago, I usedrsync
with public key authentication and was running everything as root usingsudo -i
, then only it worked. It never prompted for password for sending permission protected files as I was running as root. Try this if you have root access.