sudo apt-get install samba
2、一般情况下需要在/etc/samba/smd.conf文件使能共享文件:
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
comment = /home/wusc //被共享的目录
browseable = yes //权限
3、添加账户
现在要添加newsfan这个网络访问帐户。
方式一、如果系统中当前没有这个帐户,那么:
sudo useradd newsfan
要注意,上面只是增加了newsfan这个用户,却没有给用户赋予本机登录密码。所以这个用户将只能从远程访问,不能从本机登录。而且samba的登录密码可以和本机登录密码不一样。
现在要新增网络使用者的帐号:
sudo smbpasswd -a newsfan
在这一部分会出现问题:
提示信息:
Failed to initialise SAM_ACCOUNT for user newsfan. Does this user exist in the UNIX password database ?
Failed to modify password entry for user newsfan
原因:
添加的用户newsfan必须是系统用户(系统->系统管理->用户和组->添加)
方式二、使用系统本身已有的账户登陆
sudo smbpasswd -a newsfan
newsfan是你系统本身的用户
方式三,当然也可以去认真阅读一下/etc/samba/smb.conf配置文件,来添加用户,不过这样麻烦,上面用命令添加更方便
修改密码之后要重启samba服务器:
service smbd restart