Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Typically non-root users cannot mount directories.

Running Redhat Have 6GB tar.gz (/dir/somefile.tar.gz) Need to move to a NFS share on another box (//somebox/somefolder/)

We have no other access.

Any ideas?

share|improve this question
    
Need a lot more information... Do you have root on source, target, both? Do you have access to regular accounts on source, target, both? Can you use. e.g. scp(1), rsync(1), ...? Can you dismount the disk from the target, connect it to the source, and copy data that way? Are the sysadmins of target, source, or both, sensitive to bribery? Blackmail? –  vonbrand Feb 26 '13 at 2:36
    
and why don't you mount that nfs share as root? also, most desktop environments have some setuid services so that non root users can access network shares as tell. why don't you have one of those? Obviously, you can't copy a file to an unmounted remote nfs share. so you need to figure out a way to mount that share. why do the "normal" ways not work for you? –  Bananguin Feb 26 '13 at 8:55
add comment

2 Answers 2

up vote 2 down vote accepted

The mount command can only be executed as root on most Linux systems, because it has a setuid of root set. There are 2 possible work arounds using the mount command, but they require that the root user (or somebody that can sudo to root) make some changes.

  1. Have them add an entry to /etc/fstab for the desired share. The noauto option is important.

    vi /etc/fstab
    <nfs ip or FQDN>:/      /mnt/       nfs rw,noauto,user,timeo=14,hard,intr 0 0
    

    Then have them run mount for the desired directory

    mount /mnt/
    
  2. Add the user to the suders file, specifying use of the mount command. Please note that this is less secure, because they can essentially mount anything on the file system. Run visudo and add a line like this:

    afhood    ALL=(ALL) /usr/bin/mount
    
  3. Perform some form of network based copying to the remote file system such as scp, rcp, ftp, sftp, etc. The specific command you would use is completely dependent on what the remote system allows and what you have installed on your system.

share|improve this answer
    
It should be mentioned that, to avoid errors while using sudo, one should use visudo, as it performs some syntax checking, as is explicitly stated in the manpage of sudoers(5). –  rbrito Feb 26 '13 at 4:12
add comment

I'm going to assume that the server is configured to only allow this particular client to connect. Otherwise you could use a client where you did have root access. (How the server identifies this client is something worth questioning too, in a pinch.)

If you must use NFS and don't have root access on the client, then my first thought is to find a userspace NFS client or NFS browser. The only one I've found so far is JFtp, which is a Java GUI client. However, if you're a programmer and so inclined, another option is to roll your own; there is a library called libnfs1 that you could build from.

I haven't tried either of them, but hopefully this is a start. There may be more out there that I haven't noticed. Finally, beware that the NFS server may require you to connect as root (from a privileged port), in which case you're out of luck.

...Alternately, I just noticed your '//somebox/somefolder/' nomenclature, which is highly unusual for NFS, but standard for SMB (Samba / Windows filesharing), at least on Linux machines. If that's the case, then the tool you want is smbclient.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.