Friday, September 11, 2009

Wedding ;)

Linux - users and group of users

There are three user types in Linux systems:
- root (as known as superuser) - has all access to all parts of Linux system
- system user - connected with some services inside of the system
- normal user.

Users' data is stored in /etc/passwd file. Each of rows in this file is connected with one user. Structure of each row is shown below.

login:password:UID:GID:name:homedir:shell

login - user's identifier
password - user's password (now it is usually stored in /etc/shadow file due to security improvement)
UID - User ID - root UID = 0, systems acount UID=100-999, user accounts UID>1000
GID - Group ID - number of main group of user
name - user's name (usually name and surname)
homedir - home dir of user
shell - default shell for user

For example this file can look like the following one:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh


As it was mentioned before user passwords are stored in /etc/shadow file. Structure of rows from this file was shown below:

login:password:date1:num1:num2:num3:num4:date2:res

login - user's login
password - user's password (encoded)
User is able to insert some special characters in this place:
! or *- means that this account has been blocked
!! - user has not set any password yet
date - date of last password modification
num1 - number of days before the next password modification
num2 - number of days to change the password
num3 - number of days when the system informs user about password expiration
num4 - number of days after the account is blocked
date2 - date of block of account
res - reserved field

Example entry was shown below:

waldekd:$1$AZK6J/bg$BLkas/oh3BKHRas0b.3/f0:14479:0:99999:7:::

Every user in the Linux-based system belongs to one or more groups. Main group number connected with the user is included in the /etc/passwd file.
Groups' data is included in /etc/groups file.Each row from the file has structure as was shown below:

gr_name:pass:GID:users

gr_name - group name
pass - group password
GID - Group ID
users - users assigned to this group

Example file:
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:waldekd
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:


All passwords connected with group are stored in /etc/gshadow file. Its structure is similar to /etc/shadow file:

gr_name:pass:admins:users

gr_name - name of group
pass - group's password
admins - group's admins
users - users assigned to this group.

To get info about users and groups you can use command listed below:

id - prints info about UID, GID and other group user belongs to.
For example:

waldekd@waldekd-laptop:~$ id
uid=1000(waldekd) gid=1000(waldekd) groups=4(adm),20(dialout),24(cdrom),46(plugdev),108(lpadmin),123(admin),124(sambashare),1000(waldekd)

waldekd@waldekd-laptop:~$ id root
uid=0(root) gid=0(root) groups=0(root)


groups - lists group user belongs to.

waldekd@waldekd-laptop:~$ id root
uid=0(root) gid=0(root) groups=0(root)


finger - gets info about user.

waldekd@waldekd-laptop:~$ finger waldekd
Login: waldekd Name: Waldemar Dacko
Directory: /home/waldekd Shell: /bin/bash
On since Fri Sep 11 11:42 (CEST) on tty7 from :0
2 hours 34 minutes idle
On since Fri Sep 11 12:16 (CEST) on pts/0 from :0.0
No mail.
No Plan.


Adding user
To add some new user you can use on of these command:
useradd - creates some new user or modifies default settings of existing one.

waldekd@waldekd-laptop:~$ sudo useradd -d /home/magdalena -g users -s /bin/bash magdalena

If some of the settings are not provided by you the system defaults they according to the /etc/default/useradd file.
useradd -D modifies default settings.

adduser - adds user to the system

VIM

Well, I have heard a lot of various comments about this editor, but according to me (and not only) this is the most advanced text editor in the world. But there are some people who smiled looking at this post... For these people VI is so hard to learn. I understand that you prefer some scintilla-engine-based editor (like Scite, Notepad++ and many others) to VIM - this is your choice of course. But try VI at first and then comment it.

Below I have presented excellent sheet covers most of the VI commands (http://www.viemu.com/)

Linux - how to get some help

There are various of methods which helps you in getting some help.
man - the best known way of getting help (e.g. man who)
info - hypertext help system (e.g. info who)
apropos - looking for text strings inside of database of system commands (e.g. apropos who)

Linux - Hierarchical directory according to the FHS standard

For the Linux operating systems there are two main standards determine hierarchy of directories in main file system: FSSTND and FHS. The FHS is an improved version of FSSTND which is addressed not only for Linux systems but also for other Unix-like distributions.
According to the FHS all files there are in some hierarchical structure with one root "/" (it does not depend on whether these files are on one logic disc or many).

/bin/ - basic executable files available for all users
/boot/ - bootloader files
/dev/ - files connected with devices
/etc/ - configuration files
/home/ - home directories of users
/lib/ - libraries for programs from /bin and /sbin directories
/mnt/ - using for mounting file systems
/media/ - mount-points for removable devices
/opt/ - application compiled in statical way
/proc/ - informs about processes state
/root/ - home directory for root user
/sbin/ - application using for system management
/tmp/ - temporary files
/usr/ - second-level hierarchy sharing between users
/var/ - various types of files

Saturday, April 4, 2009

Letter of application

Dear Sir or Madam

I have seen you job offer (ADV 10/09) on your website and I would like to apply. I am a 27-year-old Pole with a lot of commitment and motivation. I am friendly and open minded person with a lot of organizational skills and determination as well.

When I was a student I started working as a guide and it gave me a lot of enjoyment. Since then I have been really interested in it. Thanks to this job I was given a possibility to visit many European countries and familiarize with their histories what I can use working for you. Your job seems to be the perfect opportunity to combine the job with my passion.

My knowledge of English is very good and I have been improving it by attending some courses in one of the best English schools. Because of it confidently talking with people is not a problem for me.

I am sure I would make a success of this job and I hope you will consider my application.

Yours faithfully

Waldemar Dacko

Wednesday, July 9, 2008

The best sport I've done ever...

I think that the best sport which was invented by human is cycling. If you don't share my opinion please read the following article. I hope it helps you to change your point of view.
At the beginning of this short article I would like to show a piece of bikes' history. Bikes were invented by Germany's Baron von Drais in 1817. The first one was almost completely made of wood and it didn't have pedals - if you wanted to move, you had to use your legs. The speed record for this bicycle was 15km/h. The first bike with pedals was created in 1865 and it was known as velocipede ("fast foot"). In 1870 the first all metal machine appeared. It was very strang because it had two different wheels: one was very large and the second very little, so cycling on it was so dangerous. The first "modern" bike was produced by Yale in 1898.
Why was invention of bike so important for many people? I think there is a lot of reasons. First of all is that bikes give people the possibility to move from one place to another without using cars. These days, where price of petrol is still growing up, it is very important. In addition to this cycling is enviromentally friendly. The second main reason is that almost every is able to ride a bike, because it isn't too hard to learn. Of course riding a bike doesn't depend on your age - cycling is for old people and for very young as well. This is also a great way to spend your free time, because you can see something new and be in a place you've never been before instead of watching TV or playing computer games.
What about an equipment? It seems to be obvious that if you want to ride a bike you have to have a bike. Many people think that bikes are very expensive and they can't afford to them. I agree with them, but I want to add one small thing. Professional bikes that are made of very weightless materials are very expensive (e.g. they cost as much as a middle class cars). But an amateur bike costs about 200-300PLN. I think it is not so much money, because if you have to go to your work by bus, a bike costs less money than you have to spend on bus tickets per month. And of course riding a bike can help you to be more healthy.
To summarize this short article I'd like to encourage you to using a bike as the main way to move from one place to another, because it makes your life more interesting and more healthier. And you can meet very interesting people....

Search This Blog