Ubuntu 安装Samba教程

1、安装 Samba 

  1.  首先安装samba:  sudo apt install samba samba-common -y 
  2.  创建共享文件夹:sudo mkdir /home/samba
  3. 我们将samba文件夹软链接到桌面:ln -s /home/samba /home//桌面/ 
  4. 将创建的文件夹修改权限:sudo chmod 777 /home/samba -R
  5. 修改文件:sudo vim /etc/samba/smb.conf 在最后面加上下面代码
[samba]
    comment=samba
    path = /home/samba
    public = yes
    writable = yes
    create mask = 0644
    directory mask = 0755

     6. 将 samba 加入开机启动项:systemctl enable smbd

     7. 启动 samba systemctl start smbd

完成!

2、shell 编辑命令行安装:

#!/bin/bash 
echo '密码' | sudo -S apt install samba -y
echo '密码' | sudo -S mkdir /home/$USER/samba
echo '密码' | sudo -S ln -s /home/$USER/samba /home/$USER/桌面
echo '密码' | sudo -S chmod 777 /home/$USER/samba -R
echo -e "[samba]\ncomment = samba\npath = /home/$USER/samba\npublic = yes\nwritable = yes\ncreate mask = 0644\ndirectory mask = 0755" | sudo -i tee -a /etc/samba/smb.conf;
echo '密码' | sudo -S systemctl enable smbd
echo '密码' | sudo -S samba systemctl start smbd

你可能感兴趣的:(#,ubuntu,#,树莓派,Linux,samba,ubuntu,linux,共享)