Professional Documents
Culture Documents
USER
Red Hat Linux uses a User Private Group (UPG) Scheme
2- System users
3- Normal users
System users:-
Normal users:-
Normal users are the users created by root user. They
are normal user i.e
Ram, Mukesh, John etc. Only the Root user has the permission to
create or remove a user.
In Linux every user will have a unique user ID. It is known as UID.
The range of UIDs will be as follows:
USER UID
Root 0 (Zero)
System user 1 - 499
Normal user 500 - 60000
There are three important files a user admin should be aware of.
1) /etc/passwd
1 2 3 4 5 6
7
1) User name
3) UID
4) GID ( group id )
5) Comment for user
6) Home Directory
2- /etc/shadow
etc/group
3-All the configuration files for linux are stored in simple text files
so things like user accounts group accounts etc all that
information is stored in a text file & that text file is the -
/etc/passwd . By modifying or editing this file you can rename
user, change their home directories etc. If you want to see the
Users or their home directories etc on your Linux system ,all you
do is - sudo vim /etc/passwd
GROUP
Group is a collection of user to whom the same permission are to
be applied.
1) Primary
2) Secondary
The info regarding the group are stored in the following files:
/etc/group
/etc/gshadow
PERMISSION
In Linux normally permission are referred to by a three digit
number like 777,757,700. This three digit number basically says
what the permission are for the file.
The first digit is the permission that the Owner of the file has.
The third digit is the permission for everybody else in the world or
others.
So 4=Read
2=Write
1=Execute
Here 4+2+1=7
How to Change the permission for a file:- sudo chmod 777
filename -R
OWNERSHIP
To change a ownership of a file or folder
LINUX PROCESS
What is a Process?
Processes are much like us .They are born, they die. They have
Parent & Children.
Starting a Process
When you start a process (run a command), there are two ways you can
run it
Foreground Processes
Background Processes
Foreground Processes
By default, every process that you start runs in the foreground. It gets its
input from the keyboard and sends its output to the screen.
You can see this happen with the ls command. If I want to list all the files in
my current directory, I can use the following command
$ls ch*.doc
This would display all the files whose name start with ch and ends with .doc
Background Processes
A background process runs without being connected to your keyboard. If
the background process requires any keyboard input, it waits.
The advantage of running a process in the background is that you can run
other commands; you do not have to wait until it completes to start
another!
Here if the ls command wants any input (which it does not), it goes into a
stop state until I move it into the foreground and give it the data from the
keyboard.
That first line contains information about the background process - the job
number and process ID. You need to know the job number to manipulate it
between background and foreground.
If you press the Enter key now, you see the following
The first line tells you that the ls command background process finishes
successfully. The second is a prompt for another command.
LISTING PROCESSES
To List the running Process for Current User Command is- ps
One of the most commonly used flags for ps is the -f ( f for full)
option, which provides more information as ps -f
Column Description
UID User ID that this process belongs to (the person running it).
Option Description
Stopping Processes
Ending a process can be done in several different ways. Often,
from a console-based command, sending a CTRL + C keystroke
(the default interrupt character) will exit the command. This
works when process is running in foreground mode.
$ps -f
UID PID PPID C STIME TTY TIME CMD
amrood 6738 3662 0 10:23:03 pts/6 0:00 first_one
amrood 6739 3662 0 10:22:54 pts/6 0:00 second_one
amrood 3662 3657 0 08:10:53 pts/6 0:00 -ksh
amrood 6892 3662 4 10:51:50 pts/6 0:00 ps -f
$kill 6738
Terminated
$kill -9 6738
Terminated
Most of the commands that you run have the shell as their
parent. Check ps -f example where this command listed both
process ID and parent process ID.
Daemon Processes
Daemons are system-related background processes that often
run with the permissions of root and services requests from other
processes.
$top
Some processes might be considered mission critical for your situation, while others
may be executed whenever there might be leftover resources.
High priority tasks are considered less nice, because they don't share resources as well.
Low priority processes, on the other hand, are nice because they insist on only taking
minimal resources.
When we ran top at the beginning of the article, there was a column marked "NI". This
is the nice value of the process:
top
Tasks: 56 total, 1 running, 55 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Mem: 1019600k total, 324496k used, 695104k free, 8512k buffers
Swap: 0k total, 0k used, 0k free, 264812k cached
Nice values can range between "-19/-20" (highest priority) and "19/20" (lowest priority)
depending on the system.
To run a program with a certain nice value, we can use the nice command:
nice -n 15 command_to_execute
To alter the nice value of a program that is already executing, we use a tool
called renice:
renice 0 PID_to_prioritize
Note: While nice operates with a command name by necessity, renice operates by
calling the process PID
Benefits of NFS
1. NFS allows local access to remote files.
2. It uses standard client/server architecture for file sharing
between all *nix based machines.
3. With NFS it is not necessary that both machines run on the
same OS.
4. With the help of NFS we can configure centralized storage
solutions.
5. Users get their data irrespective of physical location.
6. No manual refresh needed for new files.
7. Newer version of NFS also supports acl, pseudo root
mounts.
8. Can be secured with Firewalls and Kerberos.
NFSv2
NFSv2 supports only 32 bit.
NFSv2 only allowed the first 2 GB of a file to be read
NFSv2 operated only over UDP
NFSv3
NFSv3 supports 64 bit file system.
NFSv3 can handle files larger than 2 GB.
NFSv3 supports asynchronous writes on the server.
asynchronous writes improve write performance.
NFSv3 supports additional file attributes in many replies, to
avoid the need to re-fetch them.
NFSv3 supports READDIRPLUS operation. READDIRPLUS
operation get file handles and attributes along with file
names when scanning a directory.
NFSv3 supports TCP. Using TCP as a transport made NFS over
a WAN more feasible.
NFSv4
NFSv4 supports only TCP.
NFSv4 retains all NFSv3 advantages.
NFSv4 supports ACLs.
NFSv4 uses the virtual file system to present the server's
export.
NFSv4 supports Pseudo file system. Pseudo File System
provide maximum flexibility. Exports Pathname on servers
can be changed transparently to clients.
NFSv4 have locking operations as the part of protocol which
keep track of open files and delegations.
NFSv4 works through firewalls and on the Internet and no
longer requires rpcbind service.
Required Services:-
Red Hat Enterprise Linux uses a combination of kernal-level
support and daemon processes to provide NFS file sharing. All NFS
version depends on Remote Procedure Calls (RPC) service
which is controlled by rpcbind service. In earlier version of RHEL
portmap service was used to map RPC program number to IP
address port number combinations. This service is now
replaced by rpcbind to enable IPv6 support.
nfs
service nfs start starts the NFS server and the appropriate RPC
processes to service requests for shared NFS file systems.
nfslock
service nfslock start activates a mandatory service that starts the
appropriate RPC processes allowing NFS clients to lock files on the
server.
rpcbind
rpcbind accepts port reservations from local RPC services. These
ports are then made available (or advertised) so the
corresponding remote RPC services can access them. rpcbind
responds to requests for RPC services and sets up connections to
the requested RPC service. This is not used with NFSv4.
rpc.mountd
rpc.nfsd
rpc.nfsd allows explicit NFS versions and protocols the server
advertises to be defined. It works with the Linux kernel to meet
the dynamic demands of NFS clients, such as providing server
threads each time an NFS client connects. This process
corresponds to the nfs service.
lockd
lockd is a kernel thread which runs on both clients and servers. It
implements the Network Lock Manager (NLM) protocol, which
allows NFSv2 and NFSv3 clients to lock files on the server. It is
started automatically whenever the NFS server is run and
whenever an NFS file system is mounted.
rpc.statd
This process implements the Network Status Monitor (NSM) RPC
protocol, which notifies NFS clients when an NFS server is
restarted without being gracefully brought down. rpc.statd is
started automatically by the nfslock service, and does not require
user configuration. This is not used with NFSv4.
rpc.rquotad
This process provides user quota information for remote users.
rpc.rquotad is started automatically by the nfs service and does
not require user configuration.
rpc.idmapd
rpc.idmapd provides NFSv4 client and server upcalls, which map
between on-the-wire NFSv4 names (which are strings in the form
of user@domain) and local UIDs and GIDs. For idmapd to function
with NFSv4, the /etc/idmapd.conf file must be configured. This
service is required for use with NFSv4, although not when all
hosts share the same DNS domain name.
NFS Services:-
Its a System V-launched service. The NFS server package
includes three facilities, included in the portmap and nfs-utils
packages.
#setup
Step 3:- Then check your NIC Configuration with the help of
following command.
# Ifconfig
Step 5:- In this step you have to verify that NFS Server
packages are installed.
#rpm qa nfs-utils*
#rpm qa rpcbind*
Step 6:- In the next step, create a new directory to share with
client and named it whatever you want, you can also share an
already existing directory with NFS.
#mkdir /nfsshare
Step 8:- Now start the rpcbind and nfs service by using the
following command.
Step 9:- To turn on the above services at boot time, execute the
following command.
#chkconfig nfs on
#showmount -e
#setup
Step 2:- If youre NIC not configured, then first configure your
NIC.
#setup
#ping 172.18.209.9
Step 4:- In this step you have to verify that NFS Server
packages are installed.
#rpm qa nfs-utils*
#rpm qa rpcbind*
Step 5:- at the NFS client end, we need to mount that directory
in our server to access it locally. To do so, first we need to find out
that share available on the remote server or NFS Server.
Execute the following command to find out the available
share on the NFS Server.
#showmount e 172.18.209.9
Step 6:- Use the following command to mount that NFS share on
our client machine.
Now edit the /etc/fstab file and add the following line
to this file.
#vim /etc/fstab
#umount /mnt
You can see that the mounts were removed by then looking at the
file system again.
#df h F nfs
Important Commands for NFS:-
Some more important commands for NFS.