Question

When I do this I end up with no such file or directory and permission denied...

When I do this I end up with no such file or directory and permission denied could you tell me what i'm doing wrong?

useadd ashley
useradd lynn

groupadd -g 150 uGroup1
groupadd -g 151 uGroup2

usermod -g uGroup1 ashley
usermod -g uGroup2 lynn

vi sh1.sh

tail -2 /etc/passwd|cut -d: -f1,2,3,4,5,6,7

if test -d /home/ashley/usr

then

rm -r /home/ashley/usr

fi

mkdir /home/ashley/usr

if test -d /home/lynn/etc

then

rm -r /home/lynn/etc

fi

mkdir /home/lynn/etc

ls -l /home/ashley/usr|grep “^-”|head -1

ls -l /home/lynn/usr|grep “^-”|head -1

u1= `ls -1 /root|grep “^-”|head -1|tr -s “ “|cut -d “ “ -f 3`

echo $u1

g1= `ls -1 /root|grep “^-”|head -1|tr -s “ “|cut -d “ “ -f 4`

echo $g1

ls -R /usr>/home/ashley/usr/usrListing.txt

ls -R /etc>/home/lynn/etc/etcListing.txt

chown ashley:uGroup1 /home/ashley/usr/usrListing.txt

chown lynn:uGroup1 /home/lynn/etc/etcListing.txt

f1= `wc -c /home/ashley/usr/usrListing.txt|cut-d “ “ -f 1`

f2= `wc -c /home/lynn/etc/etcListing.txt|cut-d “ “ -f 1`

echo ashley file had $f1 bytes

echo lynn file had $f2 bytes

0 0
Add a comment Improve this question Transcribed image text
Answer #1

tail -2 /etc/passwd | cut -d: -f1,2,3,4,5,6,7

if test -d /home/ashley/usr
then
sudo rm -rf /home/ashley/usr
fi

sudo mkdir /home/ashley/usr

if test -d /home/lynn/etc
then
sudo rm -rf /home/lynn/etc
fi

sudo mkdir /home/lynn/etc

ls -l /home/ashley/usr | grep "^-"|head -1
ls -l /home/lynn/etc | grep "^-"|head -1

u1= `ls -1 /root|grep "^-"|head -1|tr -s " "|cut -d " " -f 3`
echo $u1
g1= `ls -1 /root|grep "^-"|head -1|tr -s " "|cut -d " " -f 4`
echo $g1

ls -R /usr > /home/ashley/usr/usrListing.txt
ls -R /etc > /home/lynn/etc/etcListing.txt

sudo chown ashley:uGroup1 /home/ashley/usr/usrListing.txt
sudo chown lynn:uGroup1 /home/lynn/etc/etcListing.txt

f1=`wc -c /home/ashley/usr/usrListing.txt | cut -d " " -f 1`
f2=`wc -c /home/lynn/etc/etcListing.txt | cut -d " " -f 1`

echo ashley file had $f1 bytes
echo lynn file had $f2 bytes

ubuntu17 (fresh) [Running)- Oracle VM VirtualBox File Machine View Input Devices Help Activities Text Editor Wed 00:42 sh1.sh

Output
*********

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)

Add a comment
Know the answer?
Add Answer to:
When I do this I end up with no such file or directory and permission denied...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 2 0/1 point (graded) What happens when you remove a directory using the command rm...

    Question 2 0/1 point (graded) What happens when you remove a directory using the command rm -r? You cannot remove a directory using the rm command. You permanently remove the entire directory, including all files and subdirectories. You move the entire directory to a trash folder, but it can be restored later. You get a warning message asking if you want to proceed, then you delete the directory. incorrect Answer Incorrect: Try again. Unix does not warn you before permanently...

  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

  • Objective : Write a C Shell script which copies all files(*.java and *.class) from your home dire...

    Objective : Write a C Shell script which copies all files(*.java and *.class) from your home directory to a new one, and Analyze the new directory information such as number of files, user permissions, and disk usage. Sample Output:                                                    << CS Directory Analysis >>      Date:   ============================================================ Current Directory: /home/tomss New Directory Created : /home/tomss/pgm01 File information Total Number of files : 22 files Directory files:   0 files Plain text files:   10 files File have read permissions: 3 files File have...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT