Home > Documentation > SAMBA > Samba commands

Samba commands

Posted by peter on October 26, 2011

smbstatus

When typed at the command prompt, this command will give you the status of any clients logged on to your server. See below:

 

--------------Example----------------------

linuxserver:~ # smbstatus

 

Samba version 3.0.22-13.18-SUSE-CODE10

PID Username Group Machine

-------------------------------------------------------------------

26728 sue1 users sue1 (192.168.0.12)

25334 geoff1 users geoff (192.168.0.10)

 

Service pid machine Connected at

-------------------------------------------------------

data 25334 geoff Fri Jan 12 12:15:41 2007

data 25334 geoff Fri Jan 12 12:15:41 2007

IPC$ 25334 geoff Fri Jan 12 14:09:06 2007

profiles 26728 sue1 Fri Jan 12 14:02:56 2007

users 25334 geoff Fri Jan 12 14:09:14 2007

data 26728 sue1 Fri Jan 12 13:59:17 2007

users 26728 sue1 Fri Jan 12 14:02:56 2007

No locked files

linuxserver:~ #

-------------Example end-----------------

 

Nmblookup

nmblookup is used to query NetBIOS names and map them to IP addresses in a network using NetBIOS over TCP/IP queries. The options allow the name queries to be directed at a particular IP broadcast area or to a particular machine. All queries are done over UDP. The exact sysntax can be seen in the “man” file. A simple example is shown below:

 

--------------Example----------------------

linuxserver:~ # nmblookup geoff

querying geoff on 192.168.0.255

192.168.0.10 geoff<00>

linuxserver:~ #

-------------Example end-----------------

 

useradd and passwd

These commands are used to add a user in Linux, you will need to use these commands to get SAMBA to work effectively. You might need to use the “-m” switch to create a “home” directory for the user depending on the version of Linux you use. Once you have created a user with the “useradd” command, you will need to change the user's password with the “passwd” command. This is important, as without this, the users password will be unencrypted and he/she won't be able to log on. See example below.

 

--------------Example----------------------

 

[linuxserver/]# useradd -m fred

[linuxserver /]# passwd fred

Changing password for user fred.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[linuxserver/]#

-------------Example end-----------------

 

smbpasswd

This command is used to create a SAMBA user once a “linux” user has been created. (see useradd and passwd). NB You need to add the same user in both locations, ie /etc/passwd and /etc/samba/smbpasswd . The example below creates a SAMBA log on for “fred”, a user already setup in Linux. you need to use the “-a” and the “-e” option as root to add, then, enable the SAMBA user. More info on the smbpasswd command can be found in the MAN file.

 

--------------Example----------------------

 

[linuxserver/]# smbpasswd -a fred

New SMB password:

Retype new SMB password:

Added user fred.

[linuxserver /]# smbpasswd -e fred

Enabled user fred.

[linuxserver/]#

-------------Example end-----------------

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha CodeClick the image to see another captcha.