Debian

在 NTFS-3G Samba 共享上從 Windows 登錄失敗

  • October 5, 2012

我有一個連接到格式化為 NTFS 的外部硬碟的 Raspberry Pi(儘管可以是任何 Debian Linux 機器)。

我的磁碟掛載fstab是:

/dev/sda1 /media/disk  ntfs-3g  defaults,uid=1000,gid-1000,dmask=007,fmask=007  0  0

其中使用者 1000 是“pi”使用者

/media/disk/shared 是我的 Samba 根文件夾。必須可從 Windows 和 Mac 訪問

現在,我可以在 Windows 中看到共享,但我的權限被拒絕。如果我嘗試將驅動器映射到它,並嘗試使用 \machinename\pi 登錄,則登錄失敗。

有任何想法嗎?

編輯——下面的 smb.conf。我已刪除所有註釋行(我假設以 # 或 ; 開頭的行是註釋)

[global]

  workgroup = WORKGROUP
  server string = %h server
  dns proxy = no
  log file = /var/log/samba/log.%m
  max log size = 1000
  syslog = 0
  panic action = /usr/share/samba/panic-action %d
  encrypt passwords = true
  passdb backend = tdbsam
  obey pam restrictions = yes
  unix password sync = yes
  passwd program = /usr/bin/passwd %u
  passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
  pam password change = yes
  map to guest = bad user

  usershare allow guests = yes

[shared]
  comment = Ali and Greg Shared Folders
  writeable = yes
  public = yes
  browseable = yes
  path = /media/disk/shared
  guest only = yes
  guest ok = yes

  read only = no

  create mask = 0777
  directory mask = 0777

[printers]
  comment = All Printers
  browseable = no
  path = /var/spool/samba
  printable = yes
  guest ok = no
  read only = yes
  create mask = 0700

[print$]
  comment = Printer Drivers
  path = /var/lib/samba/printers
  browseable = yes
  read only = yes
  guest ok = no

[hdd]
  comment = Samba server's HDD
  read only = no
  locking = no
  path = /media/disk/shared
  guest ok = yes

這是我的配置,它可以工作:

[public]
comment = Public Storage
path = /media/hddusb
create mask = 0660
directory mask = 0771
read only = no
guest ok = yes
browseable = yes

從 0 到 RaspberryPi (Debian) 上的 Samba!

root@raspberrypi:/var/log# uname -a
Linux raspberrypi 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux
root@raspberrypi:/var/log# cat /etc/issue
Debian GNU/Linux wheezy/sid \n \l

這適用於我的 Pi。這smb.conf是 8 行(不包括空白)。我使用testme密碼設置為testme. 除了設置密碼之外,您可以逐行粘貼這一行。

##the REQUIRED smbpasswd is part of samba-common-bin -- YOU MUST EXPLICITY SELECT IT
aptitude install samba samba-common-bin
mkdir -p /data/share
chmod 1777 /data/share
cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

cat > /etc/samba/smb.conf << "EOF"
workgroup = workgroup
netbios name = rpi
encrypt passwords = yes

[share]
path = /data/share
read only = no
browseable = yes
valid users = testme
EOF

useradd -s /bin/bash -d /home/testme -m testme
passwd testme ##set password
smbpasswd -a testme ##set same password; this is used for samba authentication

/etc/init.d/samba restart

### DONE!! ###

引用自:https://unix.stackexchange.com/questions/49608