2022年05月02日 23:42 0 人评论 9 人阅读
$ sudo apt-get install samba
$ sudo vim /etc/samba/smb.conf
将smb.conf文件中有关home目录共享的配置(193~214行):
188 #======================= Share Definitions =======================
189
190 # Un-comment the following (and tweak the other settings below to suit)
191 # to enable the default home directory shares. This will share each
192 # user\'s home directory as \\\\server\\username
193 ;[homes]
194 ; comment = Home Directories
195 ; browseable = no
196
197 # By default, the home directories are exported read-only. Change the
198 # next parameter to \'no\' if you want to be able to write to them.
199 ; read only = yes
200
201 # File creation mask is set to 0700 for security reasons. If you want to
202 # create files with group=rw permissions, set next parameter to 0775.
203 ; create mask = 0700
204
205 # Directory creation mask is set to 0700 for security reasons. If you want to
206 # create dirs. with group=rw permissions, set next parameter to 0775.
207 ; directory mask = 0700
208
209 # By default, \\\\server\\username shares can be connected to by anyone
210 # with access to the samba server.
211 # Un-comment the following parameter to make sure that only \"username\"
212 # can connect to \\\\server\\username
213 # This might need tweaking when using external authentication schemes
214 ; valid users = %S
215
修改为
188 #======================= Share Definitions =======================
189
190 # Un-comment the following (and tweak the other settings below to suit)
191 # to enable the default home directory shares. This will share each
192 # user\'s home directory as \\\\server\\username
193 [homes]
194 comment = Home Directories
195 browseable = yes
196
197 # By default, the home directories are exported read-only. Change the
198 # next parameter to \'no\' if you want to be able to write to them.
199 read only = no
200
201 # File creation mask is set to 0700 for security reasons. If you want to
202 # create files with group=rw permissions, set next parameter to 0775.
203 create mask = 0755
204
205 # Directory creation mask is set to 0700 for security reasons. If you want to
206 # create dirs. with group=rw permissions, set next parameter to 0775.
207 directory mask = 0755
208
209 # By default, \\\\server\\username shares can be connected to by anyone
210 # with access to the samba server.
211 # Un-comment the following parameter to make sure that only \"username\"
212 # can connect to \\\\server\\username
213 # This might need tweaking when using external authentication schemes
214 valid users = %S
215
创建samba帐户的方法如下:
- 添加用户:sudo useradd 用户名
- 设置密码:sudo smbpasswd -a 用户名
$ sudo smbpasswd -a arkinux
New SMB password:
Retype new SMB password:
Added user arkinux.
sudo /etc/init.d/smbd restart
映射的格式为:
\\server\username
其中server为Ubuntu的ip地址,username为Ubuntu的用户名
例如:
\\192.168.1.128\arkinux
发表评论 已发布 0 条