Ubuntu install samba service

1. Install samba
sudo apt-get install samba

2. Check whether samba is successfully installed
$ sudo dpkg -l samba*
Desired state = unknown(u)/install(i)/remove(r)/clear(p)/keep(h)
| Status=Not Installed (n)/Installed (i)/Configuration Only (c)/Unpack Only (U)/Configuration Failed (F)/Incomplete Installed (H)/Trigger Waiting (W)/Triggered device pending (T)
|/ error?=(none)/reload required (R) (status, error: uppercase=failure)
||/ Name Version Architecture: Description
+++-==============-============-============-=================================
ii  samba          2:4.1.17+dfs amd64        SMB/CIFS file, print, and login s
un samba-ad-dc <none> <none> (no description available)
ii  samba-common   2:4.1.17+dfs all          common files used by both the Sam
ii  samba-common-b 2:4.1.17+dfs amd64        Samba common files used by both t
un samba-doc <none> <none> (no description available)
ii  samba-dsdb-mod 2:4.1.17+dfs amd64        Samba Directory Services Database
ii  samba-libs:amd 2:4.1.17+dfs amd64        Samba core libraries
un samba-tools <none> <none> (no description available)
ii  samba-vfs-modu 2:4.1.17+dfs amd64        Samba Virtual FileSystem plugins
un samba4 <none> <none> (no description available)
un samba4-common <none> <none> (no description available)
un samba4-common- <none> <none> (no description available)


The first ii indicates that the installation was successful. You can see that samba is installed.

3.
mkdir /home/username/share (create a new share folder)

chmod 777 /home/username/share (set the permissions of the folder to make it readable, writable and runnable by all users)

Backup and edit smb.conf Allow network users to access (make a good habit of backing up at any time, you will find out how wise the original backup is when it is critical!) Code:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup

sudo gedit /etc/samba/smb.conf

adds the Share segment at the end of the text, where /home/share/samba is a shared directory
    [Share]
    comment = Shared Folder with username and password
    path = /home/share/samba #Share path
    public = yes
    #Writable = no   
    #Writable valid users = samba #Authenticate users
    create mask = 0750 #Create file permissions
    directory mask = 0750 #Create directory permissions
    force user = samba #Subordinate user
    force group = sambashare #Subordinate user group
    available = yes
    browseable = yes

If you want users to have write permissions, set writable = no, change to writable = yes

sudo /etc/init.d/samba restart restart samba

win7 enter \\linuxIp access

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326846674&siteId=291194637