As we all know the user list reside in /etc/passwd, so we can view the registered user by looking up at this file.
But now the fuss is that it also contains many other fields & machine trust accounts & inbuilt accounts.
So now we'll make a command of our own..
We'll start by
1.cat /etc/passwd
2.As we all know that by default all the users created will have their home directories in /home share
so we'll modify our command a bit by using grep.
Now it'll be
cat /etc/passwd | grep "/home"
3. Now we'll get all the user accounts which have their home share in /home.
But the only output we need is the list of users & nothing else.
4. So we'll modify our command again
cat /etc/passwd | grep "/home" |cut -d: -f1
Now what we have done is that we have piped the output of previous command to another variable "cut"
What we have done here is we have added
cut -d: -f1
-d: means delimiter :
-f1 means display first field of line i.e. username.
So final command is
Cat /etc/passwd |grep "/home" |cut -d: -f1
This works until all your users have their home share in /home. If you have defined their home share to some other destination. Modify the above command.
(Hint : In previous case we started grep "/home" , this time we'll use grep "/bin/bash" or whatever valid shell you are using)
Now command will be like..
Cat /etc/passwd |grep "/bin/bash" |cut -d: f1
Blog Archive
-
►
2010
(79)
-
►
June
(11)
- Protect Web Directories using .htacess
- eth0_rename in ethernet card
- Reset windows password using linux live CD
- IPP printer configuration in windows
- Reinstall WIndows Fax and Picture viewer
- Stream audio in Bluetooth Headset using Dongle
- Convert image files to text
- Configuring exim4 in Ubuntu to use GMail for SMTP
- Change apache2 web directory
- Checking webserver vulnerabilities
-
►
June
(11)
-
▼
2009
(22)
-
▼
December
(15)
- adding xp recovery console to boot menu option
- Receive email anonymously
- Change vsftpd login default path
- Make SMTP mail server in xp
- Enable cmd / regedit xp
- Installing RAID in server 2003
- How to install subversion (SVN) and create users
- Adding user and adding user to group in LINUX
- View all users in linux
- Configure TCP/IP from the Command Prompt
- ctrl alt Del in Remote Desktop
- Adding a startup script to be run at bootup in Lin...
- Change Ownership of Group and user in Linux
- Setting Up file Ownership and Permissions in Linux...
- Check the amount of Space occupied by a Directory
-
▼
December
(15)
Sunday, December 6, 2009
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment