Friday, October 25, 2013

Useful UNIX SMB Commands

Learned a lot of SMB commands during the last test, thought to share with everyone:
##To list all the domain current machine can talk to
$ wbinfo —all-domains 
##To get the DC for a particular Domain
$ wbinfo —getdcname=<DOMAINNAME>
##List of all users in domain in /etc/passwd style
$ getent passwd > /tmp/users
$ wbinfo -u
##Same for groups
$ getent group
$ wbinfo -g
##To get info about a user on a DC (-P use the configured password on this machine)
$ net user info spider -P -S <DC_HOST>
<List of groups the user belongs to>
##To add a user to the domain
$ net user add <user> <pass> -P –S <DC_HOST>
##Get the current authorised user
$ net getauthuser
##if this works, you might want to check the secrets.tdb file 
$ strings /etc/samba/secrets.tdb | grep USER 
$ tdbdump /etc/samba/secrets.tdb

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.