Some important commands regarding user and group

Tuesday, November 17, 2009
Your Ad Here
To Change owner of a file
chown user_name file_name
Example: You want to make gautam as owner of beragautam.tx
chown gautam beragautam.tx

To change owner and group of a file
chown user_name.group_name file_name

You can also use this command as follows –
chown user_nam:group_name file_name
(Please note, you can use either “:” or “.”)

If you want to assign a file would be used by a group use the following command.
chgrp special atanu.tx
Here group name is special and file name is beragautam.tx

What is a group?
A group is used to represent users, who have similar characteristics,exercise similar tasks and
enjoy similar permission and environment in a network. Now think about the situation here.
You have a group of users who need similar type of access to a file, beragautam.tx. What you will do? Very simple

Create a group.

Issue the command that enables the group to access the file

Give file access permission to this group. (Example, all permissions to owner and read and
execute permissions to group)

Make the users members of a group.

Do these tasks as defined below.
groupadd newgroup
chgrp newgroup bera.tx
chmod 750 beragautam.tx

And then add the user to this group.

vi /etc/group
At the bottom of the file verify the entry related to newgroup and add the user name. It
will look like –
newgroup:x:600:beragautam,gautam

Here, beragautam and gautam are members of the newly created group, ‘newgroup’. The thing
must be noted is, usernames are specified by comma (,) separated form. However,
instead of editing th e /etc/group file directly, we can use commands to add or remove
users from a group.

If we want to add members (in our example, the name of the group is acct and the
members are red and green), we can use the following command –
gpasswd –M red,green acct

If we want to add user ‘blue’ in the ‘acct’ group we can use the following command –
gpasswd –a blue acct

To remove user red from the acct group, we can use the following command –
gpasswd –d red acct

Labels: , , , , , , , , , , , ,

 
posted by Gautam at 1:30 AM, | 0 comments

IP Forwarding

Saturday, April 25, 2009
Your Ad Here
IP Forwarding is a feature of the LINUX kernel, which can be turned on or off,
if needed, without rebooting the computer. It is very much needed, especially
when a LINUX system is used as a Firewall/Router or a Proxy Server for
a network and is doing Network Address Translation (NAT) to masquerade
a private subnet behind a single public IP address. In this regard,
what Administrators do is –
Install two network cards (one will be assigned with the real or public IP
address and the second will be assign ed with the private IP address.)
To turn IP Forwarding on we can run the following command –
echo 1 > /proc/sys/net/ipv4/ip_forward
The above command will enable IP forwarding for the current session,
as the default setting is “disable”. To make it permanent, modify /etc/sysctl.conf as follows -
net.ipv4.ip_forward = 1
By default the value 0 is set, means the NATing is disabled. However, after modifying
/etc/sysctl.conf, reboot your machine to make it permanent. During the time of
booting the computer will check the /etc/sysctl.conf and read the IP forwarding related
parameters net.ipv4.ip_forward = x and load it to /proc/sys/net/ipv4/ip_forward file.
However, by executing - echo 1 > /proc/sys/net/ipv4/ip_forward you can enable IP
forwarding instantly.

Labels: , , , , , ,

 
posted by Gautam at 1:10 AM, | 0 comments

About Linux short briefing

Saturday, April 4, 2009
Your Ad Here
Linus Torvalds introduced LINUX in 1991. LINUX is developed keeping UNIX as a
reference model. We can consider LINUX as another version of UNIX. Mr. Linus has made the source code of the LINUX KERNEL available for study, develop and change over the internet. LINUX is an open-development model. It accepts modification to the KERNEL code. Now different distributions are available in the internet. Like RedHat, Mandrake,Slackware, SUSE etc. The core of the LINUX System is KERNEL. It controls the resource of the computer and allots these resources to users and different tasks. In other words we can say the KERNEL allows the users to interact with the hardware. However, we must keep in mind,users cannot access the KERNEL directly. Rather they use a simple user interface to communicate with the KERNEL, called a SHELL.
We will use RedHat E nterprise Linux Release 4 in the training program.
Before starting here is quick look to -
UNIX SHELL
Bourne Shell (sh) : Original UNIX shell written by Steven Bourne at AT&T.
C Shell (csh) : Written by Bill Joy at UC Berkeley
Korn Shell (ksh) : Written by David Korn at AT&T.
Bourne Again Shell (bash) : The default shell for RedHat Linux. We will find
many of the extra features of all the above shells – these include –
Command line completion
Command line editing
Command line h istory
Prompt control.

Labels: , ,

 
posted by Gautam at 4:30 AM, | 0 comments