一、为什么安装samba
samba可以在ubuntu设置共享目录,从而使得同一局域网的win10可以直接访问该共享目录,非常方便,可以直接查看ubuntu服务器的图片或视频。
二、ubuntu换软件源
打开终端,备份原来的源
bash
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
如果显示 /etc/apt/sources.list 不存在,直接创建
bash
sudo vim /etc/apt/sources.list
加入以下阿里源
bash
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse focal
输入命令更新源
bash
sudo apt-get update
输入命令更新软件
bash
sudo apt-get upgrade
三、安装samba
bash
sudo apt-get install samba samba-common
四、配置samba
先备份
bash
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
编辑
bash
sudo vim /etc/samba/smb.conf
在文件最后添加
bash
[csf]
comment = csf home directory
path = /
public = yes
browseable = yes
writeable = yes
意思是把整个根目录共享
然后重启samba服务
bash
sudo systemctl restart smbd
五、win10访问ubuntu目录