I am writing a script that checks or verifies users on an Ubuntu system
Can someone please help ? I need to write or creat a script in bash that checks a users existance and then backs up the users home directories.
I am using Ubuntu 10.10.ver 4 and i'm brand new to linux. Any help would be appreciated Thanks in advance, onyxneeds |
Well, what do you mean by a user's existence?
If a user acct exists, it's in /etc/passwd, a plain text file. The user's name is the first field, the unique id ( 'uid' ) is the 3rd field of each record. What kind of backup did you have in mind? There's no (need to) chk; it's either there or its not.. Usually home for a user is /home/username/ For a newbie, read & digest http://rute.2038bug.com/index.html.gz to start with. For more bash cmds http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ HTH & Welcome to LQ :) |
Thanks for the information and sorry for the mis-communication.
My first intent was to write a shell script that by putting in a username would first check to see if that user exist and if it does exist backs up that users /home/username using the tar command I'm confused: I know of the /etc/passwd command but i'm not sure how to incorporate that into the script. |
/etc/passwd is not a command, it's a text file.
It holds a list of colon-separated values; the user name is in the first column, the sixth column holds the users home. Does that help? Cheers, Tink |
Definitely try
Code:
cat /etc/passwd |
Thanks guys that helps alot i appreciate your help
Take Care onyx |
All times are GMT -5. The time now is 06:57 AM. |