Basic_User_Environment
Basic_User_Environment
Required Materials
CentOS 7 Machine
EXERCISES (Warmup to quickly run through your system and familiarize yourself)
1. cd ~
2. ls
3. mkdir lab3
4. cd lab3
5. printenv | more #what is this showing you?
6. printenv | grep user
7. echo $PATH
8. printenv | wc –l #what does this do?
9. printenv | nl | more #does this verify the last?
10. su – student1
11. printenv | more
12. printenv | wc –l #is this more or less than root had?
f. cd /home/student1
g. mkdir old_dot_files
h. mv .* old_dot_files/
i. ls –a old_dot_files #verify files are all there
ii. ls –a #verify all dot files are not in /home/student1
i. su – student1
j. ls –la #verify that new files have been created
This can be a safe way to re-generate “dot files” for a user when they or their processes
have messed up their login files.
The /etc/bashrc file is used for aliases and functions. Take a minute to look around in your
system’s /etc/bashrc file
k. more /etc/bashrc
/etc/bashrc also does a very important function of setting the default umask
The /etc/profile script runs scripts within the /etc/profile.d directory. Take some time to
familiarize yourself with both
r. more /etc/profile
s. ls /etc/profile.d
t. su – student1
u. echo $starttime; echo $starthost #should not have anything in it
v. exit #go back to root
w. touch /etc/profile.d/startgather.sh
x. vi /etc/profile.d/startgather.sh
i. type “i”
ii. export starttime=`date +%T`
iii. export starthost=`hostname`
iv. type esc
v. hit :wq
y. su – student1
z. echo $starttime; echo $starthost #should now contain the values set in
profile.d/startgather.sh
Spend 5 minutes googling or otherwise researching online about these topics (these are for you, so take
some notes and learn some stuff here):
https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-users-add.html
Check this out and look at the variables that can be set with useradd. Do any of them surprise
you? How might these help you administer users?
http://centoshowtos.org/environment-variables/
Look specifically here at how to add a path. Not all software installs automatically add their
paths. In the case of gpfs there is a directory /usr/lpp/mmfs/bin/ that holds all the commands
and is not automatically linked.
Think of how you might do this if something were installed under
/opt/myprogram/bin/my_startup.sh