Ubuntu 10.04快速设置Samba

本文简要描述怎样在ubuntu 10上设置Samba

首先,你需要安装Samba。打开终端窗口,使用命令:

sudo apt-get install samba

根据默认提示安装Samba。现在,Samba使用一套独立的密码,而不是标准的linux系统账号。(Samba密码保存在/etc/samba/smbpasswd),所以你需要使用下面的命令为自己创建一个Samba密码:

sudo smbpasswd -a USERNAME

USERNAME,当然是你的实际用户名。)

键入一个合适的强壮的密码(保证它有大写,小写,标点符号和数字)。在密码创建以后,下一步是编辑你的文件—/etc/samba/smb.conf,它是Samba的配置文件。现在开始,在你的home文件夹建立一个文件夹,命名为'test';我们将使用它作为我们的测试共享文件夹(你可以按同样的做法建立其他共享文件夹):

Mkdir /home/USERNAME/test

下一步,拷贝原始的smb.confhome文件夹做一个安全备份,以防你出现错误:

sudo cp  /etc/samba/smb.conf ~

现在使用文本编辑器来编辑smb.conf

sudo gedit /etc/samba/smb.conf sudo vi /etc/samba/smb.conf

(菜鸟会发现图形界面的gedit是最好用的;当然你也可以方便地使用emacs或者vi,特别是当你在使用ubuntu的服务器版本,它默认不包含X11桌面。)

在装载smb.conf以后,将下面内容加到文件的最底部:

test是共享名。

[test]
 path = /home/USERNAME/test
 available = yes
 valid users = USERNAME
 read only = no
 browseable = yes
 public = yes
 writable = yes

(在每段之间不应该有空格,而且在等号的前后都应该有一个空格。)

这些设置将会共享我们先前建立的test文件夹,而且给你用户名和密码以对文件夹具有读和写的权限。做上述修改以后,保存smb.conf,退出文本编辑器,使用以下命令重启Samba服务:

sudo restart smbd

Samba重启以后,使用testparm命令检查smb.conf语法错误:

sudo testparm

如果testparm命令检查通过,Samba将会工作;尝试从另外一台局域网上的机器访问这共享的文件夹。

 

 (ubuntu 12.04也适用以上)

 

原文:http://www.hardcode.nl/archives_147/article_548-samba-quick-setup-on-ubuntu-1004.htm

Samba quick setup on Ubuntu 10.04

 

The following excerpt describes how to setup samba on ubuntu 10:

First, you’ll need to install Samba. Fire up a Terminal window and use this command:

sudo apt-get install samba

Follow the default prompts to install Samba. Now, Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so you’ll need to create a Samba password for yourself with this command:

sudo smbpasswd -a USERNAME

(USERNAME, of course, is your actual username.)

Type a suitably strong password (make sure it includes uppercase, lowercase, punctuation, and numbers). Once your password is created, the next step is to edit your /etc/samba/smb.conf file, the configuration file for Samba. Begin by creating a folder named ‘test’ on your home folder; we’ll use that for our test shared folder (you can create other shared folders using the same method):

mkdir /home/USERNAME/test

Next, make a safe backup copy of the original smb.conf file to your home folder, in case you make an error:

sudo cp /etc/samba/smb.conf ~

Now use your text editor of choice to edit smb.conf:

sudo gedit /etc/samba/smb.conf

(New users will probably find gedit the easiest to use due to its GUI; but you can use emacs or vi just as readily, especially if you’re using the server version of Ubuntu, which doesn’t include X11 by default.)

Once smb.conf has loaded, add this to the very end of the file:

[test]
 path = /home/USERNAME/test
 available = yes
 valid users = USERNAME
 read only = no
 browesable = yes
 public = yes
 writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.)

These settings will share the test folder we created earlier, and give your username and your username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit the text editor, and restart Samba with this command:

sudo restart smbd

Once Samba has restarted, use this command to check your smb.conf for any syntax errors:

sudo testparm

If you pass the testparm command, Samba should be working; try accessing the shared folder from another computer on your LAN.

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值