Install Samba Server on Ubuntu

[url]http://www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/[/url]


If you want to share files between your Ubuntu and Windows computers, your best option is to use Samba file sharing.


To install, first open a terminal window and enter the following command:

sudo apt-get install samba smbfs

We’ve got samba installed, but now we’ll need to configure it to make it accessible. Run the following command to open the configuration file, substituting your editor of choice:

sudo gedit /etc/samba/smb.conf

Find this section in the file:

####### Authentication #######

# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
; security = user

Uncomment the security line, and add another line to make it look like this:

security = user
username map = /etc/samba/smbusers

This will set Samba to use the smbusers file for looking up the user list.

Create a Samba User

There are two steps to creating a user. First we’ll run the smbpasswd utility to create a samba password for the user.

sudo smbpasswd -a <username>

Next, we’ll add that username to the smbusers file.

sudo gedit /etc/samba/smbusers

Add in the following line, substituting the username with the one you want to give access to. The format is <ubuntuusername> = “<samba username>”. You can use a different samba user name to map to an ubuntu account, but that’s not really necessary right now.

<username> = “<username>”

Now you can create samba shares and give access to the users that you listed here


ps : you should check the "selinux" config , or there maybe "tree connect failed: NT_STATUS_BAD_NETWORK_NAME" error


from: http://hi.baidu.com/51cmdshell/blog/item/ee1114ae43b014c77cd92ac6.html

Ubuntu Samba服务安装与配置
2010年02月17日 星期三 12:14

一. Ubuntu samba配置的安装:

sudo apt-get install samba smbfs smbclient

二. 创建共享目录:

mkdir /home/komy/share
sodu chmod 777 /home/komy/share

三. 创建Ubuntu Samba配置文件:

1. 保存现有的配置文件
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
2. 修改现配置文件
sudo gedit /etc/samba/smb.conf
在smb.conf最后添加
[share]
path = /home/komy/share
available = yes
browsealbe = yes
public = yes
writable = yes

其实,更为简单的是在ubuntu下右击文件夹属性,在共享里设置共享,但实质上系统更改了smb.conf文件.

四. 创建Ubuntu samba帐户

sudo touch /etc/samba/smbpasswd
sudo smbpasswd -a komy #komy必须为系统中存在的账户

然后会要求你输入samba帐户的密码

如果没有第四步,当你登录时会提示 session setup failed: NT_STATUS_LOGON_FAILURE]

五. 重启Ubuntu samba服务器

sudo /etc/init.d/smbd restart

六. Ubuntu Samba配置测试

smbclient //localhost/share

七,Ubuntu Samba配置使用

可以到windows下输入ip使用了,在文件夹处输入 "\\" + "Ubuntu机器的ip或主机名" + "\\" + "share"
Samba是一个允许Linux和Windows操作系统之间共享文件和打印机的开源软件。要在Ubuntu上安装和配置Samba服务器,可以参考引用中的文章。在文章中,详细说明了如何安装和配置Samba作为Windows和Linux操作系统的文件存储系统,并介绍了如何使用其他Linux和Windows客户端操作系统访问Samba共享文件。在配置Samba服务器之前,请确保服务器和客户端操作系统在同一个IP子网中,并且使用NAT网络连接(如果是在Ubuntu虚拟机上)。在创建共享文件夹时,可以使用如下命令在服务器上创建相关文件夹,并赋予适当的权限: ``` sudo mkdir -p /samba/HR sudo mkdir /samba/IT sudo mkdir /samba/PM sudo chmod -R 777 /samba/ ``` 此外,还需要创建账号和密码来控制访问权限。可以使用适当的命令来创建账号和密码,并关联到相应的文件夹。具体的命令可以参考引用中的文章。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【sambaUbuntu20.04安装并配置Samba服务](https://blog.csdn.net/oNelson123/article/details/125414617)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [工具说明书 - 在Ubuntu上配置Samba服务](https://blog.csdn.net/guoqx/article/details/122731635)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [ubuntu 20.04搭建samba文件共享服务器,实现基于Linux和Windows的共享文件服务](https://blog.csdn.net/Nanford/article/details/127703691)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值