I have a NTFS format hard disk connected by usb to router livebox,
I have a raspberry pi with Raspbian installed.
I try to mount a folder from HD to folder inside raspberry pi
create local folder in user home /home/pi
mkdir mySharedFolder
drwxr-xr-x 2 pi pi 4096 Oct 31 17:10 mySharedFolder
mount the folder
sudo mount -t cifs -o vers=1.0,_netdev,username=pi,password=mypassword,uid=1000,gid=1000,file_mode=0777,dir_mode=0777 //192.168.1.1/discosUSB/WDElements_10B8/Elements/hdFolder /home/pi/mySharedFolder
ls -la
drwxrwxrwx 2 pi pi 0 Oct 31 17:20 mySharedFolder
It mounts correctly because I can see the files and directories
ls -la mySharedFolder/
-rwxrwxrwx 1 pi pi 5 Oct 31 17:17 file.txt
drwxrwxrwx 2 pi pi 0 Oct 31 17:18 folder1
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 14G 1.4G 12G 11% /
devtmpfs 213M 0 213M 0% /dev
tmpfs 217M 3.1M 214M 2% /run
tmpfs 217M 0 217M 0% /sys/fs/cgroup
tmpfs 44M 0 44M 0% /run/user/1000
//192.168.1.1/discosUSB/WDElements_10B8/Elements/hdFolder 8.0G 2.5G 5.5G 32% /home/pi/mySharedFolder
Too I can open file.txt
cat mySharedFolder/file.txt
Hello
But I can't copy files to the directory:
sudo cp a.jpg mySharedFolder/
cp: error writing 'mySharedFolder/a.jpg': Permission denied
If I list content directory, I can see a.jpg file created whith 0 bytes
ls -la mySharedFolder/
-rwxrwxrwx 1 pi pi 0 Oct 31 17:32 a.jpg
-rwxrwxrwx 1 pi pi 5 Oct 31 17:17 file.txt
drwxrwxrwx 2 pi pi 0 Oct 31 17:18 folder1
Using Android ES File Explorer I can see the folder and I can copy, delete, create files in hard disk share folder without problems
Additional info
sudo smbclient -L //192.168.1.1
Sharename Type Comment
--------- ---- -------
cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe srvsvc failed with error NT_STATUS_BUFFER_TOO_SMALL
discosUSB Disk Share Folder
IPC$ IPC Remote Inter Process Communication
Reconnecting with SMB1 for workgroup listing.
Server Comment
--------- -------
Workgroup Master
--------- -------
What am I doing wrong?
Thanks
a.jpg
file. While you are usingsudo
(no password proimpt?) maybe It is somehow possible that you do not have read permissions on that file. Just checked by creating ana1.jpg
file with execute permissions only with :touch a1.jpg && chmod 111 a1.jpg && chown user1 user1 a1.jpg
asroot
in user1 directory, and then trying to copy it as that user1 within the user tree and got the same permission denied error, even though user1 is set as the owner of the file (he can change permissions himself if needed but can't copy the file without doing so first). – NetIceCat Oct 31 '19 at 19:49ntfs
mounts force root as default user. Also check the actual mount incat /etc/mstab
– NetIceCat Oct 31 '19 at 20:37cd mySharedFolder/
sudo echo 123 > test123.txt
and the result isecho write error: Permission denied
Also I test mount with
– enraged Nov 06 '19 at 20:22uid=$(id -u),gid=$(id -g),forceuid,forcegid
with the same result, Permission denied when copy and creating file Thanks a lot for your help