setup and test samba server

来源:互联网 发布:淘宝客服表格 编辑:程序博客网 时间:2024/04/27 22:42

Configuration

/etc/samba/smb.conf  You knew it. Only security and [homes] are not default, the others are default. In this configuration, all the \\server\\username can be accessed.

[global]   workgroup = WORKGROUP   server string = %h server (Samba, Ubuntu)   dns proxy = no   log file = /var/log/samba/log.%m   max log size = 1000   syslog = 0   panic action = /usr/share/samba/panic-action %dsecurity = user   encrypt passwords = true   passdb backend = tdbsam   obey pam restrictions = yes   unix password sync = yes   passwd program = /usr/bin/passwd %u   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .   pam password change = yes   map to guest = bad user[homes]   comment = %U Home Directories   browseable = Yes   read only = no   create mask = 0660   directory mask = 0700   valid users = %S
For other user(not the user created during the OS installation but created with user add)
We still need to sudo smbpasswd -a <username>

Could we use unix user dirctly?

Show smbpwd users

$ sudo pdbedit -Lw

Test samba

Linux command line

smbclient -L <IP>  -U guest -N #list
smbclient -L <IP> -U <username> #list

smbclient \\<IP>\<username> -U <username> # login

Mount for current user

sudo apt-get install cifs-utils

sudo mount.cifs -o username=<samba username>,uid=${USER} //<samba server>/directory/  /<local directory>

Windows

You may get 'Multiple connections' or 'disconnect previous connections' error in windows
rem list the connections
net use
rem remove all the connections
net use * /delete

usershare

Allow non-root/sudoers to create shares

0 0
原创粉丝点击