[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 110: Undefined array key "cached"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 111: Undefined array key "normal"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 112: Undefined array key "total"
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3391: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3395: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
Cabrillo College Linux Classes • View topic - task 1&2 scripts

task 1&2 scripts

UNIX/Linux System Administration

task 1&2 scripts

Postby patrick weaver on Tue Dec 16, 2008 1:10 pm

TASK I

groupadd -g 600 dogs

useradd -g dogs -u 601 -c "one ofn three dogs" -d home/dog-one -s /bin/bash dog-one

passwd dog-one # Do Passwd Dialogue for each of three. (dog1, dog2, dog3)

passwd -d dog-one

usermod -L dog-two
chage -d 0 dog-two
usermod -U dog-two

user mod -L dog-three

vi /home/dog-one/.bash_profile
> alias woof=who
ctrl,wq;

echo "All Dogs Welcome Here." > /etc/motd


tail /etc/group >> task1
tail /etc/motd >>task1
tail /etc/shadow >> task1 #..(!dog-three)
tail /home/dog-one/.bash_profile >> task1
tail /etc/group >> task1
cat task1 >> final

TASK II:

# Turn off machine. Add a 5g hard disk. Turn machine on.

fdisk /dev/sdb # (n, p, +200M, w)
mke2fs -t ext3 /dev/sdb1
mount /dev/sdb1 /mnt
cd /home
cp -R * /mnt
mkdir /saves
mv -Rf * /saves
e2label /dev/sdb1 /home

vi /etc/fstab
# append "LABEL=/home /home ext3 usrquota,defaults 1 2 " to /etc/fstab/

mount -0 usrquota /dev/sdb1 /home

quotacheck -cuv /dev/sdb1

edquota dog-one # edit the "hard" and "soft" collumns (4500,5000)
OR "setquota -u dog-one 4500 5000 0 0 -a /dev/sdb1" ####lesson 9 slide 97

repquota -a

edquota -p dog-one `awk -F: '$3 > 499 (print $1)' /etc/passwd`

cd /home/dog-one

su dog-one ##test quotas

dd if=/dev/zero of=filler bs=1024 count=200
> big; for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do du; cat filler >> big; done
patrick weaver
 
Posts: 28
Joined: Tue Sep 02, 2008 7:13 pm

Re: task 1&2 scripts

Postby Joe Bobisuthi on Tue Dec 16, 2008 3:48 pm

@task 2
Actually you do not want to use the copy command to copy the files, because if you do that the files that are put into the soon-to-be home directory all belong to root.

Something like this:

mount /dev/sdb1 /mnt
cd /mnt (cd /home; tar cvf - . ) | tar xvf -

would probably work better.
Joe Bobisuthi
 
Posts: 11
Joined: Tue Sep 02, 2008 7:13 pm

Re: task 1&2 scripts - Perl

Postby keivn dodd on Tue Dec 16, 2008 6:32 pm

I was trying to do a perl script so you can take a whole array of user names and make the accounts in one loop but I couldn't get it to run bash commands from the filesystem. Alternatively you can use perl to generate a #!/bin/bash script.

#!/usr/bin/perl
@accounts = / user1 user2 user3 user3 user4 user5 user6/;
$hpath="/home/";
foreach (@account) {
mkdir $hpath$_;
}
keivn dodd
 
Posts: 43
Joined: Sat Sep 13, 2008 2:30 am


Return to CIS 191B - Fall 2008

Who is online

Users browsing this forum: No registered users and 0 guests

cron