For AI agents: the complete documentation index is available at https://www.tteam.icu/llms.txt, the full documentation bundle is available at https://www.tteam.icu/llms-full.txt, and this page is available as Markdown at https://www.tteam.icu/ops/linux/%E6%8C%82%E8%BD%BDsmb.md.

挂载smb

单次挂载

apt-get install cifs-utils -y

mount.cifs -o user=123,pass=123 //127.0.0.1/backup /backup

开机自动挂载

mkdir -p /root/.config/samba/ /backup
cat << EOF > /root/.config/samba/backup
username=123
password=123
EOF
chmod 600 /root/.config/samba/backup
cat << EOF >> /etc/fstab
//127.0.0.1/backup  /backup  cifs  credentials=/root/.config/samba/backup,uid=1000,gid=1000,file_mode=0644,dir_mode=0755,iocharset=utf8,nofail  0  0
EOF
systemctl daemon-reload
mount -a