admin 管理员组

文章数量: 887021

一、刷armbian

N1已降级,“N1-ADBU盘启动(傻瓜包)”开启U盘启动。

  1. 文章推荐armbian 5.77比较稳定。
    https://www.right/forum/thread-498873-1-1.html

  2. U盘刷入armbian,下载dtb文件放到U盘dtb文件夹。
    meson-gxl-s905d-phicomm-n1-xiangsm.dtb

  3. 打开uEnv.ini,修改配置

  4. U盘插入靠近HDMI接口的USB,N1插电启动,找到N1的IP地址,putty连接
    初始用户名,密码为root,1234

  5. 写入EMMC,完成后关机,拔U盘重启
    /root/install.sh

二、更改软件源

  1. 源文件 /etc/apt/sources.list
    中科大源
    deb http://mirrors.ustc.edu/debian stretch main contrib non-free
    deb http://mirrors.ustc.edu/debian stretch-updates main contrib non-free
    deb http://mirrors.ustc.edu/debian stretch-backports main contrib non-free
    deb http://mirrors.ustc.edu/debian-security/ stretch/updates main contrib non-free
    清华源
    deb https://mirrors.tuna.tsinghua.edu/debian/ stretch main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu/debian/ stretch main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu/debian/ stretch-updates main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu/debian/ stretch-updates main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu/debian/ stretch-backports main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu/debian/ stretch-backports main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu/debian-security/ stretch/updates main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu/debian-security/ stretch/updates main contrib non-free
    阿里源
    deb http://mirrors.aliyun/debian stretch main contrib non-free
    deb http://mirrors.aliyun/debian stretch-proposed-updates main contrib non-free
    deb http://mirrors.aliyun/debian stretch-updates main contrib non-free
    deb-src http://mirrors.aliyun/debian stretch main contrib non-free
    deb-src http://mirrors.aliyun/debian stretch-proposed-updates main contrib non-free
    deb-src http://mirrors.aliyun/debian stretch-updates main contrib non-free
    deb http://mirrors.aliyun/debian-security/ stretch/updates main non-free contrib
    deb-src http://mirrors.aliyun/debian-security/ stretch/updates main non-free contrib
    deb http://mirrors.aliyuncs/debian stretch main contrib non-free
    deb http://mirrors.aliyuncs/debian stretch-proposed-updates main contrib non-free
    deb http://mirrors.aliyuncs/debian stretch-updates main contrib non-free
    deb-src http://mirrors.aliyuncs/debian stretch main contrib non-free
    deb-src http://mirrors.aliyuncs/debian stretch-proposed-updates main contrib non-free
    deb-src http://mirrors.aliyuncs/debian stretch-updates main contrib non-free
    deb http://mirrors.aliyuncs/debian-security/ stretch/updates main non-free contrib
    deb-src http://mirrors.aliyuncs/debian-security/ stretch/updates main non-free contrib
  2. 更新
    sudo apt update
    sudo apt upgrade

三、安装SMB

进入armbian-config,到安装软件页面,Samba空格选中,再回车安装。

四、配置SMB

  1. 修改配置文件/etc/samba/smb.conf,直接覆盖原内容,实现匿名直接连接。
[global]
	workgroup = WORKGROUP
    server string = Samba Server Version %v
    passdb backend = tdbsam
    cups options = raw
    security = user                    #认证模式为User
    map to guest = bad user            #这个很关键,实现匿名无须交互输入用户名和密码就靠它了
    guest account = guest              #匿名用户映射为guest用户

[myshare]                    #共享后看到的文件夹名
    comment = My share
    path = /home/public      #共享路径
    browseable = Yes         #可以被浏览,就是在网络邻居中能看到共享名
    read only = No           #可读写
    guest ok = Yes           #允许匿名访问,这个也需要设置,否则匿名无法访问
    valid users = samba liuag guest    #有效的用户和组
    invalid users = liuben   #无效用户和组   
    read list = samba    #只读用户和组(如果read only = No,只读用户需要在此设置)
    write list = liuag   #可读写用户和组(如果read only = Yes,可读写用户需要在此设置)
    allow hosts = 192.168.100.236    #允许访问主机列表,支持通配符
    deny hosts = 192.168.100.0/24    #禁止访问主机列表,支持通配符

简洁版

[global]
       workgroup = WORKGROUP
       security = user
       map to guest = Bad User
[media]
       comment = resources
       path = /home/public
       public = yes
       writable = yes
       guest ok = yes
       browseable = yes
  1. 修改目录权限
    chmod -R 777 /home/public
  2. 开机启动SMB
    systemctl enable samba
  3. 重启SMB
    systemctl restart samba
  4. 参考
    https://wwwblogs/-xuan/p/10293859.html

五、挂载U盘

  1. 插上U盘,lsblk查看U盘盘符,这里是/dev/sda1

  2. 挂载U盘到刚才的共享目录/home/public
    mount /dev/sda1 /home/public

  3. 用命令blkid /dev/sda1查看UUID并记下

  4. 设置开机挂载,nano /etc/fstab,加上以下内容,ntfs为当前U盘类型
    UUID=722059EC2059B835 /home/public ntfs defaults 0 0

  5. 启动挂载(好像不用这步也可以)
    mount -a

  6. 参考
    https://blog.csdn/qq_38265101/article/details/105470939
    https://www.right/forum/thread-1285840-1-1.html
    https://zorz/post/flash-phicomm-n1-and-smb.html

六、固定MAC,更新时间

  1. ifconfig记录当前MAC地址
  2. 修改配置文件nano /etc/network/interfaces
source /etc/network/interfaces.d/*

# Wired adapter #1
#allow-hotplug eth0
auto eth0
no-auto-down eth0
iface eth0 inet dhcp
hwaddress fc:7b:07:87:44:33  #新增此条
#address 192.168.0.100
#netmask 255.255.255.0
  1. 改为上海时区
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  2. ntp设置
apt -y install ntp
apt -y install ntpdate
ntpdate -u ntp.aliyun #阿里云 ntp 服务器
  1. 参考
    https://cyhour/1333/

本文标签: 文件共享 Armbian SMB