assign user with root privilege and permisssion to access system files
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
assign user with root privilege and permisssion to access system files
Hi all,
I want to write a cron job script to backup up the system files of the remote machine through ssh.
As the remote machine does not allow ssh root login for security reason, how to create an ordinary account that has root
privilege and permission so that this account can access and read those files that required root privilege and permission
Why dont you log in normally, and then "su" and then issule the crontabs? This way the crontabs are running from the root user but I've given you below how to make a new user with root
create a new user
type the command: "adduser", if that doesn't work, useradd -m <username>
set the password: passwd <user>
set the group: gpasswd -a <username> root
and the user should have root access, allowing it to read and write root files. - This does set a secuirty risk to the operating system.
I don't get what is mean about login normally and then "su" and then issue crontabs.
The script will run in the local machine and will connect to remote mahine through ssh. The sample script will be as follows:
cd /home/backup
ssh user@remotemachine "cd / ; tar cf - etc"|tar xvf -
( The user need root privilege and permission to access the remote machine /etc directory )
well how I mean, "su" is a super user command, it allows you to log in as root from a normal user account.
[paw-fox@ ~]$ su
Password: (your root password)
[root@ /]#
Whatever I do when logged into SU will run as root, so if I deicded to do crontab it would be running from root. if you used your script: "crontab -e 30 18 * * * ssh user@remotemachine "cd / ; tar cf - etc"|tar xvf -" (I know it woudn't work) it would run the process given as root allowing full acess to the system
If you can already login as a normal user (I assume you can) use the SU command
Last edited by Master Fox; 07-27-2007 at 09:15 AM.
I would have to pass, my scripting abities are quite low when it comes to bash scripting, I guess another way would be do all your jobs would be placing it in a file
---
cd /home/backup
tar cf - etc"|tar xvf -
---
then use crontab to run that script, so
"crontab -e 50 11 * * * bash script.sh"
but otherwise I can't help you any more.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.