Académique Documents
Professionnel Documents
Culture Documents
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
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
$userna
me)
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