Connect to my Network attached storage from command line

Just wondering if there is a way
Similar to netuse to map a directory
On my Nas server from linux so i can
Backup things from linux server to my nas
Nas.
What is required? Do i need to install
Smb? The nas server may be a linux
Box. Its iosafe. Not sure.

Depends a bit on what you’re NAS is exporting, CIFS (SMB), NFS or something else.

For CIFS try something like this:


mount -t cifs -o rw,username=<username>,password=<password>,workgroup=<domain> //<Your NAS>/<share> /mnt

For NFS, you may try something like this:


mount -t nfs <Your NAS>:/<share> /mnt

Both mount the share specified by <share> on server <Your NAS> in mountoint /mnt

Louis

As a side note, for a SMB share you can also pipe the output of your favorite backup program to smbclient so you don’t need to mount anything. For example:


$ tar -cz /home | smbclient -N //*server*/*share* -c 'put - backup.tar.gz'

Where //server/share accepts guest access.

I don’t know if the same thing can be done with NFS.

ahgmonitor:/mnt # mount -t smbfs -o 10.1.0.15:/Backup /mnt/nas
mount: can’t find /mnt/nas in /etc/fstab

I forgot how to add linux directories in fstab.

/mnt/nas is where I want to mount my nas Backup directory.

Thanks

I added this in fs tab //10.1.0.15/Backup /mnt/nas smbfs username=username,password=password

now I’m getting this

ahgmonitor:/mnt/nas # mount -t smbfs -o 10.1.0.15:/Backup /mnt/nas
mount: unknown filesystem type ‘smbfs’

I can’t go and flip the kvm till monday to use a gui. is there a command line command to open a port for cifs or nfs in the suse firewall. than again
I don’t have authority to add those filesystems to the windows box. why can’t it just mount on smbfs?

I also tried this ahgmonitor:/mnt/nas # zypper install smbfs
Retrieving repository ‘KDE Extra’ metadata …[done]
Building repository ‘KDE Extra’ cache …[done]
Retrieving repository ‘openSUSE-12.3-Update’ metadata …[done]
Building repository ‘openSUSE-12.3-Update’ cache …[done]
Retrieving repository ‘openSUSE-12.3-Update-Non-Oss’ metadata …[done]
Building repository ‘openSUSE-12.3-Update-Non-Oss’ cache …[done]
Loading repository data…
Reading installed packages…
‘smbfs’ not found in package names. Trying capabilities.
‘samba-client’ providing ‘smbfs’ is already installed.
Resolving package dependencies…
Nothing to do.

Why in heavens sake then won’t it mount???

Try specifying -t cifs instead:

mount -t cifs -o rw,username=<username>,password=<password>,workgroup=<domain> //<Your NAS>/<share> /mnt

Is there a command line way to allow cifs through the firewall? I can’t get to the gui till monday.

also tried

tar -cz /etc/nagios/objects | smbclient -N //10.1.0.15/Backup -c ‘put - nagiosobjects.tar.gz’
tar: Removing leading `/’ from member names
session setup failed: NT_STATUS_ACCOUNT_DISABLED

Any idea how to enable NT_STATUS_ACCOUNT

On 3/15/2014 10:36 AM, bperrotta wrote:
> Is there a command line way to allow cifs through the firewall? I can’t
> get to the gui till monday.

bperotta;

You can always run YaST in “ncurses” mode from the command line.


su -
yast

Navigate with arrow, tab, enter and alt keys. The SuSEfirewall2 is found in:
Security and Users > Firewall to open ports go to the Allowed Services tab. AFAIK there should be no need to open ports
for a cifs mount.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

Not sure what to do?

On 3/15/2014 10:56 PM, bperrotta wrote:
> This isn’t working either "ahgmonitor:~ # mount -t cifs -0
>>rw,username=<username>,password=<password>!,workgroup=ahghotels
>>//10.1.0.15/Backup /mnt/nas
>>-bash: !,workgroup=ahghotels: event not found

Well for one thing it should be -o (lower case oh), not -0 (numeral zero). See man mount for details.

PS: I sure hope you posted a fake password. If not change it now.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

Maybe its the syntax

Will try later

Ok

It’s like this:


mount -t cifs //SERVER /mountpoint -o rw,username=xx,password=xx

what’s wrong with your syntax is at least the exclamation mark in the options part.

Going to try that out

Nope “mount error(13): Permission deniedRefer to the mount.cifs(8) manual page (e.g. man mount.cifs)”

Why am I getting permissions errors?

Will smb work at gui level? I may try to use dolphin monday to copy data.

I tried this command “mount -t cifs //10.1.0.15/Backup /mnt/nas -o rw,username=user,password=password”

got output above.

On 3/16/2014 11:46 AM, bperrotta wrote:
>
> Nope “mount error(13): Permission deniedRefer to the mount.cifs(8)
> manual page (e.g. man mount.cifs)”
>
> Why am I getting permissions errors?
>
> Will smb work at gui level? I may try to use dolphin monday to copy
> data.
>
> I tried this command “mount -t cifs //10.1.0.15/Backup /mnt/nas -o
> rw,username=user,password=password”
>
> got output above.
>
>
bperrotta;

The mount command must be run as root. Before executing the mount command run the su command.


su -
mount -t cifs ....etc..

A cifs mount generally requires that you also set the uid and gid option, so that your user will have permissions on the
system. i.e.


mount -t cifs -o rw,username=user,password=bigsecret,uid=bperrotta,gid=user //10.1.0.15/Backup /mnt/nas

This HowTo is a bit old but still valid. It may help you formulate your mount command:

http://swerdna.dyndns.org/susesambacifs.html

P.V.
“We’re all in this together, I’m pulling for you” Red Green

I was root but I’ll check out that post

Doing it with uid and gid getting event not found.

This is painful. all I want to do is mount a share on a nas box.

On 3/16/2014 4:06 PM, bperrotta wrote:
>
> bperrotta;2630853 Wrote:
>> I was root but I’ll check out that post
>
>
> Doing it with uid and gid getting event not found.
>
> This is painful. all I want to do is mount a share on a nas box.
>
>
bperrotta;

This sounds like a typo on your part. Remember that Linux is case sensitive. You need to post the “exact” command that
fails along with any error messages. Cut and paste from your terminal to your post. Crystal balls have a limitation on
distance.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

I added an smbfs mount for the share in fstab and got it to connect through the gui in Samba shares.

Still having problems copying over certain files though. no worries I plan on taking a clonezilla image of the whole server just in case of anything.