Vous êtes sur la page 1sur 8

Install Ubuntu VM

1. Install Ubuntu VM by using the Ubuntu ISO on the learn drive. Set
username as admin1 and password as Pa$$word.
2. Once finished installation, login to the system.

Configuring Proxy
1. Use one of the text editor to open/create a file in the /etc folder.
Command: sudo nano /etc/apt/apt.conf
In the open file, type the following (replace username and password with
your own, for example, if you tafe computer login is bob@detnsw and
password is 12345678):
Acquire::http::proxy http://
bob:12345678@proxy.det.nsw.edu.au:8080/;
Acquire::https::proxy http://
bob:12345678@proxy.det.nsw.edu.au:8080/;
Acquire::ftp::proxy http://
bob:12345678@proxy.det.nsw.edu.au:8080/;
Save the file and exit.
2. Test your connectivity to the Internet by running the following
command:
Command: sudo apt-get install zip

Script Exercise Part 3


10. Create a new script file (10.sh). In this script file, you need to:

Prompt the user to enter a new username (echo Enter the


username)
Set the user input in a variable called username (read username)
Check whether such a username exists or not (getent passwd
$username)
If username already exist, tell the user such a username exists, and
keep asking for a username that have not been used (use the while
loop)
while test $? eq 0
do
echo Username already exist, please enter a new username
read username
done

If username not exist, then prompt the user to enter the primary
group name for this username, and set the user input in a variable
called groupname
If group name already exist, tell the user such a group exists, and
keep asking for a group name that have not been used (use the
while loop)
If group name not exist, then create a group with this group name
Create a new user account with the previous entered username,
with the primary group as the newly create group, and a home
folder for this about to create user account (sudo useradd m g
$groupname $username)
Display the information for the newly created user account (id
$username)
Prompt the user to set the password for the newly created user
account (sudo passwd $username)
Assign full control permission for others on the newly created user
accounts home folder
Assign sticky bit permission to newly created user accounts home
folder

SHELL
SCRIPTS
Prompt
the
user to
enter a
new
userna
me
(echo
Enter
the
userna
me)

Set the
user
input in
a
variable
called
userna
me
(read
userna
me)

COMMANDS

Check
whethe
r such a
userna
me
exists
or not
(getent
passwd
$userna
me)

#!/bin/bash
if [ -z "$(getent passwd jsmith)" ]; then
echo "user does NOT exist."
else
echo "user DOES exist."
Fi
function get_user
{
echo -n "Enter a new user name > "
read username
echo "You entered: $username"
if [ -z "$(getent passwd $username)" ]; then
echo "User name does not exist and
will be created."
else
echo "This username is already taken
or is invalid."
echo "Please try a different user
name"
get_user
fi
}
https://ubuntuforums.org/showthread.php?t=1792819

If
userna
me
already
exist,
tell the
user
such a
userna
me
exists,
and
keep
asking
for a
userna

me that
have
not
been
used
(use
the
while
loop)
while
test $?
eq 0
do
echo
Userna
me
already
exist,
please
enter a
new
userna
me

read
userna
me
done
If group
name
already
exist,
tell the
user
such a
group
exists,
and
keep
asking
for a
group
name
that
have
not
been
used

(use
the
while
loop)
If group
name
not
exist,
then
create
a group
with
this
group
name

Create
a new
user
account
with
the
previou
s
entered
userna
me,
with
the
primary
group
as the
newly
create
group,
and a
home
folder
for this
about
to
create
user
account
(sudo
useradd
m g
$group
name

First create a file which contains all the user


name. Something like this:
nurealam
nayeem
mrahman
farid
rubi
sankar
Save the file as userlist.txt. Now create
the following bash file:
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
adduser $i
done
Save the file and exit.
chmod 755 userlist.txt

Now run the file:


./userlist.txt

This will add all the users to the system.


Now we have to change the passwords.
Let's say we want username123 as
password. So for user nayeem the password

$userna
me)

will be nayeem123, rubi123 for user rubi


and so on.

Create another bash file as follows:


There is some problem in the password
script, I have checked with the below script
it's working fine.
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
echo $i"123" | passwd "$i" --stdin
echo; echo "User $username's password
changed!"
done
Regards,
Ankur
https://www.howtoforge.com/user_password_creating_w
ith_a_bash_script

Display
the
informa
tion for
the
newly
created
user
account
(id
$userna
me)

Prompt
the
user to
set the
passwo
rd for
the

$id username

newly
created
user
account
(sudo
passwd
$userna
me)

Assign
full
control
permiss
ion for
others
on the
newly
created
user
account
s home
folder

Assign
sticky
bit
permiss
ion to
newly
created
user
account
s home
folder

Network Installation of Windows 10


1. Open OS Support folder in the learn drive and copy Deploy Windows 10
using WDS.docx file to your computer. Follow the instructions.

Vous aimerez peut-être aussi