未加星标

Set up Samba Ubuntu 12.04 LTS+

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Set up Samba   Ubuntu 12.04 LTS+

Samba is a useful program for setting up shared directories which are easily accessible from any modern operating system using CIFS or SMB. It’s a program widely associated with “windows shares” so is ideal for guaranteed interoperability in mixed-OS environments.

Check out the video below for a walkthrough demonstrating how to set up Samba on a Ubuntu 16.04 LTS host. The written guide is below as well.

NB:Ubuntu 12.04 LTS is the earliest release I’ve used this with.It should work on earlier versions as well, but your mileage may vary.

Video Installation

From the commandline, run the following to install Samba:

sudo apt install samba

This will prompt you to install a pretty hefty number of packages, with the output looking similar to the below:

Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: attr libaio1 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfile-copy-recursive-perl libldb1 libpython-stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libtalloc2 libtdb1 libtevent0 libwbclient0 python python-crypto python-dnspython python-ldb python-minimal python-samba python-talloc python-tdb python2.7 python2.7-minimal samba-common samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules tdb-tools update-inetd Suggested packages: cups-common python-doc python-tk python-crypto-dbg python-crypto-doc python2.7-doc binutils binfmt-support bind9 bind9utils ctdb ldb-tools ntp smbldap-tools winbind heimdal-clients The following NEW packages will be installed: attr libaio1 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfile-copy-recursive-perl libldb1 libpython-stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libtalloc2 libtdb1 libtevent0 libwbclient0 python python-crypto python-dnspython python-ldb python-minimal python-samba python-talloc python-tdb python2.7 python2.7-minimal samba samba-common samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules tdb-tools update-inetd 0 upgraded, 34 newly installed, 0 to remove and 0 not upgraded. Need to get 14.1 MB of archives. After this operation, 70.7 MB of additional disk space will be used. Do you want to continue? [Y/n]

If you’re happy with that, tap Enter to continue; Samba will install quite quickly and you’ll be ready to move on to configuration.

Configuration

If it doesn’t yet exist, create the directory you intend on sharing:

sudo mkdir <strong>/media/Storage</strong>

/media/Storage can be substituted for any file path and folder you wish to create.

Open the smb.conf file. This will allow you to edit the Samba workgroup (if required) and add your new share (I like Vim for editing files):

sudo vim /etc/samba/smb.conf


Set up Samba   Ubuntu 12.04 LTS+

If you use a DOMAIN/WORKGROUP, edit the following line, otherwise, skip down to near the bottom of the file:

workgroup = <strong>WORKGROUP</strong>


Set up Samba   Ubuntu 12.04 LTS+

WORKGROUP can be substituted for a domain (such as bytn.uk shown in my video) or a custom workgroup name.

Now head down to the end of the file, and add your share like so:


Set up Samba   Ubuntu 12.04 LTS+

Here’s a handy template to copy/paste:

[sharename] comment = a simple description path = /media/Storage browseable = yes readonly = no guest ok = no create mask = 0755

create mask is optional, but I’ve found it useful on occasion. The mask 0755 will give write permissions to the file owner (the user authenticating when uploading a file/folder) and read & execute permissions to everyone else. This could well instead be 0740 to allow the owner to edit, the file group to view (but not execute) and everyone else to have no permissions at all. Configure it as required.

guest ok is the difference between everyone being able to access the share without a username and password and authentication being required. In this instance I’ve required authentication in order to mount the share on a remote client as the data stored may be of a sensitive nature.

Save and quit the Vim editor by tapping Escape (ESC) , then :wq and hit Enter . This will write to the file and quit, returning you to the commandline to then be able to restart Samba:

sudo service smbd restart

Next, as the share requires authentication you’ll need usernames and passwords to access it. Start by adding a samba password for your Ubuntu user account:

sudo smbpasswd -a <strong>jason</strong>


Set up Samba   Ubuntu 12.04 LTS+

The password doesn’t have to match that of your Ubuntu user account, it can be totally unique to Samba (which isn’t a bad idea!).

If you need to add other Samba users, create a new unix account on the Ubuntu server and repeat the process above for the new user.

You should now be able to access the share from another machine!

I hope this has been helpful, as always I’m @jasonbayton on Twitter,@bayton.org on Facebook and will also respond to comments below if you have any questions.

If you spot any errors in the above, or have suggestions on how to improve this guide, feel free to reach out.

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: UbuntuWindowsFacebookTwitterCIF
分页:12
转载请注明
本文标题:Set up Samba Ubuntu 12.04 LTS+
本站链接:http://www.codesec.net/view/521507.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(99)