Monday, December 29, 2008

Checking Password Policies in Linux

To check the list of users of  linux machine, check the password or shadow password file.
cat /etc/shadow
cat /etc/passwd
cat /etc/group
cat /etc/aliases
cat /etc/sudoers

To check the policy of a user
chage -l

chage -I -1 -m 9 -M 100 -E -1

Thursday, December 18, 2008

NTFS for MAC OS X

Problem

Sometimes if you have an external drive that's NTFS formated and it's not disconnected properly from Windows, it'll come up with this message while trying to mount it in Mac OS X

$LogFile indicates unclean shutdown (0, 0)
Failed to mount '/dev/disk1s1': Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by
clicking on the 'Safely Remove Hardware' icon in the Windows
taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for
your own responsibility. For example type on the command line:

mount -t ntfs-3g /dev/disk1s1 /Volumes/WD Passport -o force

Or add the option to the relevant row in the /etc/fstab file:

/dev/disk1s1 /Volumes/WD Passport ntfs-3g defaults,force 0 0
Solution

I just had to force it to mount, and then umount it in Terminal. After unplugging and plugging the drive back in, everything works like it did before:

$>sudo mkdir /Volumes/WD\ Passport
$>sudo /usr/local/bin/ntfs-3g /dev/disk1s1 /Volumes/WD\ Passport -o force
$>sudo umount /Volumes/WD\ Passport

Taken from
http://www.elctech.com/projects/troubles-mounting-ntfs-external-drive-on-mac-os-x

Tuesday, December 16, 2008

Windows Admin Tricks

Windows SID
This is basically the internal identifier used by Windows to uniquely determine a user/group/machine.
Local machine administrator SID will always end with -500.
Guest SID will end with -501
User SID will end with -1001 (1001 signifies the first user and will auto increment with subsequent user)
This is how ACL determines if a user is allowed access to files/services/etc.


Net use
1) net use \\192.168.1.2\ipc$ password /u:domain\administrator

2) Useful sid tool (user2sid and sid2user)
user2sid \\caesars administrator
sid2user \\caesars 5 21 124532423423 4234234234234 4235234234-500

whoami /user /groups

Windows Impersonation
Let the server notify the subsystem that it is temporarily adopting the token of the client making the resource request.
*Restricted token is assigned to child processes that has more limited access than the parent token.
The token consist of all the SID that the logged user is a member of.
Eg John Smith, who is a member of group Developers, Webmaster and Requester logs into Windows. The token will consist of John Smith's SID, Developers group SID, Webmaster group SID and Requester group SID.

Assuming John tries to access file A (which is assigned to Developers group). The ACL will check if John's token consist of the Developers group SID. If yes, John will have access to file A.