Write a bash command line for the following actions; 1.- Create a reguíar user n
ID: 3700189 • Letter: W
Question
Write a bash command line for the following actions; 1.- Create a reguíar user named user01. 2.- As super-user create a directory called backup under the home directory of user01 and change the owner and group associated to the directory to user01. 3.- Set security on the backup directory so that user01 has all permissions and no one else has any permissions. 4- Write a script for creating a backup of all your data in the folder backup. In the creation of the copy of security exclude the copy of the folder backup. The name of the backup must be like backupUserData 10_26_17.zip The name of the script and location will be /home/user01/backup/backupUserData.sh 5.- Add the script above to the crontab scheduler of user01 in such a way that a new copy of security is created every Friday at 11:30 pm. Specify the text line to be added in the job schedulerExplanation / Answer
Find the answer below I have added the command needed
1.
Ans : sudo adduser user01
2.-
Ans :
cd /
cd home/
cd user01/
mkdir backup
3.-
Ans :
chown -R user01:user01 backup/
sudo chmod -R u+rX backup
4.
Ans :
a. create script
sudo touch backupUserData.sh
b. make script executable
sudo chmod +x backupUserData.sh
c. edit script
vi backupUserData.sh
d. add line
zip -r "backupUserData_$(date +"%m_%d_%y").zip" * -x backupUserData*.zip
e. save the file
5.
Ans:
30 23 * * 5 /home/user01/backup/backupUserData.sh
======================================
below is the complete trace from my pc which will help you.
=====================================
1.
android@builduntuvm:~$ sudo adduser user01
[sudo] password for android:
Adding user `user01' ...
Adding new group `user01' (1001) ...
Adding new user `user01' (1001) with group `user01' ...
Creating home directory `/home/user01' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for user01
Enter the new value, or press ENTER for the default
Full Name []: a
Room Number []: a
Work Phone []: a
Home Phone []: a
Other []: a
Is the information correct? [Y/n] y
----------------------------------------------------
2.
android@builduntuvm:/$ cd /
android@builduntuvm:/$ cd home/
android@builduntuvm:/home$ ls
android user01
android@builduntuvm:/home$ cd user01/
android@builduntuvm:/home/user01$ pwd
/home/user01
android@builduntuvm:/home/user01$ sudo mkdir backup
android@builduntuvm:/home/user01$ ls
backup
android@builduntuvm:/home/user01$
---------------------------------------------
3.
android@builduntuvm:/home/user01$ ls -l
total 4
drwxr-xr-x 2 root root 4096 Apr 4 11:06 backup
android@builduntuvm:/home/user01$ sudo chown -R user01:user01 backup/
android@builduntuvm:/home/user01$ ls -l
total 4
drwxr-xr-x 2 user01 user01 4096 Apr 4 11:06 backup
android@builduntuvm:/home/user01$
android@builduntuvm:/home/user01$ sudo chmod -R u+rX backup
--------------------------------------------------
4.
android@builduntuvm:/home/user01$ sudo touch backupUserData.sh
/// add line in the file
zip -r "backupUserData_$(date +"%m_%d_%y").zip" * -x backupUserData*.zip
android@builduntuvm:/home/user01$ sudo chmod +x backupUserData.sh
---------------------
5.add cron tab
sudo crontab -e
30 23 * * 5 /home/user01/backup/backupUserData.sh
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.