Samba
From Attie's Wiki
(Difference between revisions)
m (Created page with '= Mounting samba shares under Linux = Install the following packages: <pre> samba samba-client samba4 </pre> <br> Setup a credentials file, and secure it: <pre> username=xxx pass…') |
m (Redirected page to Ubuntu server 12.04/samba) |
||
(6 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | = | + | #REDIRECT [[Ubuntu_server_12.04/samba]] |
+ | == Configuring a Samba server == | ||
+ | Below is a simple configuration file. | ||
+ | * It will provide anonymouse access for everyone to the /home/shared directory. | ||
+ | * It will also provide authenticated access for users to their home directory. | ||
+ | * Don't forget to use <code>sudo smbpasswd -a <<i>username</i>></code> to give the users a samba account! | ||
+ | * You will need to do this as well: | ||
+ | <source lang="bash"> | ||
+ | mkdir /home/shared | ||
+ | chown nobody:nogroup /home/shared | ||
+ | chmod 775 /home/shared | ||
+ | </source> | ||
+ | |||
+ | Contents of <code>/etc/samba/smb.conf</code> | ||
+ | <source lang="ini"> | ||
+ | #======================= Global Settings ===================================== | ||
+ | |||
+ | [global] | ||
+ | follow symlinks = yes | ||
+ | wide links = yes | ||
+ | unix extensions = no | ||
+ | hide dot files = yes | ||
+ | map archive = no | ||
+ | map system = no | ||
+ | map hidden = no | ||
+ | |||
+ | # ----------------------- Netwrok Related Options ------------------------- | ||
+ | workgroup = local | ||
+ | server string = MyServer | ||
+ | |||
+ | # --------------------------- Logging Options ----------------------------- | ||
+ | # logs split per machine | ||
+ | log file = /var/log/samba/log.%m | ||
+ | # max 50KB per log file, then rotate | ||
+ | max log size = 50 | ||
+ | |||
+ | # ----------------------- Standalone Server Options ------------------------ | ||
+ | security = share | ||
+ | guest account = nobody | ||
+ | map to guest = bad user | ||
+ | |||
+ | # --------------------------- Printing Options ----------------------------- | ||
+ | cups options = raw | ||
+ | |||
+ | |||
+ | #============================ Share Definitions ============================== | ||
+ | |||
+ | [homes] | ||
+ | comment = Home Directories | ||
+ | browseable = no | ||
+ | writable = yes | ||
+ | directory mask = 0777 | ||
+ | force directory mode = 0777 | ||
+ | create mask = 0666 | ||
+ | force create mode = 0666 | ||
+ | |||
+ | [shared] | ||
+ | comment = Shared | ||
+ | browsable = yes | ||
+ | path = /home/shared | ||
+ | public = yes | ||
+ | writable = yes | ||
+ | guest ok = yes | ||
+ | force group = nobody | ||
+ | force user = nobody | ||
+ | directory mask = 0777 | ||
+ | force directory mode = 0777 | ||
+ | create mask = 0666 | ||
+ | force create mode = 0666 | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == Mounting Samba shares under Linux == | ||
Install the following packages: | Install the following packages: | ||
<pre> | <pre> | ||
Line 13: | Line 85: | ||
</pre> | </pre> | ||
<br> | <br> | ||
− | And | + | And insert the following lines to <code>/etc/fstab</code> (will need to be root or use sudo to mount/unmount): |
<pre> | <pre> | ||
<share> <mount_point> cifs user,noauto,noexec,uid=<UID>,gid=<GID>,credentials=<credentials_path>,iocharset=utf8,file_mode=0600,dir_mode=0700 0 0 | <share> <mount_point> cifs user,noauto,noexec,uid=<UID>,gid=<GID>,credentials=<credentials_path>,iocharset=utf8,file_mode=0600,dir_mode=0700 0 0 |
Latest revision as of 17:04, 3 August 2012
- REDIRECT Ubuntu_server_12.04/samba
[edit] Configuring a Samba server
Below is a simple configuration file.
- It will provide anonymouse access for everyone to the /home/shared directory.
- It will also provide authenticated access for users to their home directory.
- Don't forget to use
sudo smbpasswd -a <username>
to give the users a samba account! - You will need to do this as well:
mkdir /home/shared chown nobody:nogroup /home/shared chmod 775 /home/shared
Contents of /etc/samba/smb.conf
#======================= Global Settings ===================================== [global] follow symlinks = yes wide links = yes unix extensions = no hide dot files = yes map archive = no map system = no map hidden = no # ----------------------- Netwrok Related Options ------------------------- workgroup = local server string = MyServer # --------------------------- Logging Options ----------------------------- # logs split per machine log file = /var/log/samba/log.%m # max 50KB per log file, then rotate max log size = 50 # ----------------------- Standalone Server Options ------------------------ security = share guest account = nobody map to guest = bad user # --------------------------- Printing Options ----------------------------- cups options = raw #============================ Share Definitions ============================== [homes] comment = Home Directories browseable = no writable = yes directory mask = 0777 force directory mode = 0777 create mask = 0666 force create mode = 0666 [shared] comment = Shared browsable = yes path = /home/shared public = yes writable = yes guest ok = yes force group = nobody force user = nobody directory mask = 0777 force directory mode = 0777 create mask = 0666 force create mode = 0666
[edit]
Install the following packages:
samba samba-client samba4
Setup a credentials file, and secure it:
username=xxx password=xxx
And insert the following lines to /etc/fstab
(will need to be root or use sudo to mount/unmount):
<share> <mount_point> cifs user,noauto,noexec,uid=<UID>,gid=<GID>,credentials=<credentials_path>,iocharset=utf8,file_mode=0600,dir_mode=0700 0 0
Eg:
//baloo/l$ /home/attie/baloo-l cifs user,noauto,noexec,uid=attie,gid=attie,credentials=/home/attie/.smbcreds,iocharset=utf8,file_mode=0600,dir_mode=0700 0 0