Access NAS drive
I have a NAS that I can access fine with the Ubuntu GUI. However I want to access it via the CLI, unfortunately I can't figure out how.
If I look at the directory in the GUI it reads as smb://readynas.local/myfolder/ So I thought in the CLI I could access it using Code:
ls smb://readynas.local/myfolder/ Code:
ls: cannot access smb://readynas.local/myfolder/: No such file or directory Many thanks Tim |
Quote:
Code:
mount if you need to mount it, Code:
mount -t cifs //<ipaddress>/share /media/<some mount point> |
You need to mount the samba share in order for ls to access it. The 'GUI' does several things behind the scenes. If you have your file manager opened somewhere on the NAS, have a look at the /media directory. It probably contains a mount point. If you ls on it, you should see something...
To do it entirely using the CLI, you will need to do something as /dev/random suggested. |
Quote:
Code:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) I'm guessing /dev/sda1 is the internal HD with the OS on it. I don't have any other drives so I'm assuming /dev/sda4 is the NAS. Would this be correct? Or is it some swap partition? Does this then mean it is mounted? I would have thought that if the device is accessable via the GUI then it's mounted, is this not necessarily true? If it is mounted I still am unsure how to navigate to it. Cheers Tim |
OK I think i'm getting closer to it working.
I created a folder called nas in /media/nas then tried: sudo mount -t cifs //192.168.0.95/Tim /media/nas It asked for a root password, so it was connecting to the NAS, which is a good sign. I don't have a root password however so I gave it my admin password and it returned: mount error(13): Permission denied Fair enough I thought. I was thinking it will work fine if I could change the user from root to admin. So I did a bit of research and found the username command and tried: sudo mount -t username=admin cifs //192.168.0.95/share /media/nas And it returned a load of help information, none of which was of help in my username problem. But I feel I am learning and am almost there. What might I try next please? Cheers Tim |
Quote:
Asssuming the NAS IP is 192.168.0.95 and it has a share named 'Tim' he command should really be : Code:
sudo mount -t cifs //192.168.0.95/Tim /media/nas This being said, are you sure about the 'Tim' part of your command ? To see the share name(s) available on your NAS, type in a console: Code:
smbtree All of this assumes your nas share is not password protected. If it's password protected, you have to give a user name and password in options following the mount command. For example: Code:
sudo mount -t cifs //192.168.0.95/Tim /media/nas -o user=blabla,password=xyz |
Quote:
Sorry, I must have not been clear enough with the root password bit. What I meant was that I do not have a user called root for the NAS I was trying to access, therefore I did not have a root password for the NAS I was trying to access. I do have an admin username and password. As I said I could possibly have created a root username and password and this would have worked. However I wanted to figure out what the syntax was for manually entering a user and not having it default to root, which turned out to be that 'user=xxx' which I had figured out, but I had placed it near the start of the mount command and not at the end, which evidently makes all the difference. Cheers Tim |
Just found out that I can view the contents of the NAS when mounted but can't write anything to it. The user/pass I used to mount the drive is read/write access. I read up about it and as far as I can make out if I add -o rw to the mount command it should load with read/write permissions. So I have unmounted the drive and tried again using:
sudo mount -t cifs //192.168.0.95/Tim ~/nastim -o rw -o user=admin,password=password It mounts fine but just with read access only. Where am I going wrong please? |
You probably need to set additional options to your mount command. If you do a ls -l ~/nastim user and group columns will show 'root' or a number...
Assuming your user id is Tim and your primary group is Tim as well try to add to your options uid=Tim,gid=Tim Code:
sudo mount -t cifs //192.168.0.95/Tim ~/nastim -o rw -o user=admin,password=password,uid=Tim,gid=Tim You might have also to specify iocharset=utf8 in your options if you happen to use non standard characters (accented letters, etc..). Do a man mount.cifs to have access to all the bewilderingly numerous options :). Another thing: Having the NAS mounted might slow down considerably a shutdown or reboot of your computer. Do an umount before shutdown/reboot. There are cleaner ways to do all of this but it's partly distribution dependent... [Edit]As you're using some kind of ubuntu you should find additional information in their Wiki and forums[/Edit] |
Quote:
I know the command to unmount and will try and do so before shutdown. Is there a way to automatically mount on boot & unmount on shutdown, there has to be right? I'm guessing there exists a startup script on the computer somewhere that I can add the mount too, and a shutdown script for the unmount. Many thanks again for all your help Tim |
All times are GMT -5. The time now is 09:09 PM. |