I am trying to set up a cp command in my sudoers file to run without a password for some users. The directory I will copy to's name is unknown. I know the path to it, but the directory itself is a variable (my machine named it as the hostname, but I will need to put this sudoer file on other machines with different hostnames). Is there a way the sudoers file can fetch the hostname and/or an environment variable holding the hostname?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.