How to Mount a Remote NTFS Share for Read/Write under Linux


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to Mount a Remote NTFS Share for Read/Write under Linux
# 1  
Old 07-05-2008
How to Mount a Remote NTFS Share for Read/Write under Linux

I've done this in the past, but I didn't save the syntax. I'm still kicking myself about that...

I am trying to mount \\server_name\share_name for read/write under CentOS 5.2 (a "generic" version of RedHat). As I recall, there was a fairly simple (maybe a oneline) command that would allow NTFS to mount under Linux for read/write, without having to install a bunch of RPMs, etc.

I've searched and searched on Google and found all sorts of references to smbfs and cifs. Nothing I've tried has worked this time around.

Can someone point me in the right direction? I'm looking for syntax that has not been (hopefully will not be) deprecated.

TIA,

J
# 2  
Old 07-05-2008
To my surprise, this works (I created the /mnt/ntfs directory in an earlier step):

Code:
mount -t cifs //192.168.1.120/Linux -o username=myntaccount,password=mypassword /mnt/ntfs

ls -l /mnt/ntfs
total 0
drwxrwxrwx 1 root root        0 Mar  4 22:10 db11g
-rwxrwSrwt 1 root root 89712640 Mar  4 22:02 oracle.tar

Follow up questions:

1) How can I dismount it without rebooting? I don't see a hit for "dismount" in the mount man page.

2) How can I configure it to automount on the next boot?
# 3  
Old 07-06-2008
I found the answers, and I thought I would post them for anyone else who has had the same problem.

To dismount a temporarily mounted device:

Code:
umount /mnt/ntfs

To configure an NTFS share for write and automount:

Code:
    # Log onto the Linux computer with the root account

    # Create a credential file to hold the Windows username and password

    vi .base_linux

    cat vi .base_linux

+++ Begin screen output +++
username=my_nt_username
password=my_nt_password
--- End screen output ---

    chmod 600 .base_linux

    ls -l .base_linux

+++ Begin screen output +++
-rw------- 1 root root 35 Jul  5 23:59 .base_linux
--- End screen output ---

    # Determine the uid and gid of the account that will own the directory after it is mounted

    id my_linux_username

+++ Begin screen output +++
uid=500(my_linux_username) gid=500(my_linux_username) groups=500(my_linux_username)
--- End screen output ---

    # Edit the fstab file (note that uid 500 points to the my_linux_username Linux account)

    vi /etc/fstab

        (Add a line for //base/linux; see output from "cat /etc/fstab" below)

    cat /etc/fstab

+++ Begin screen output +++
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                   swap    defaults        0 0
//base/linux            /mnt/base_linux         cifs    auto,credentials=/root/.base_linux,uid=500,gid=500,file_mode=0777,dir_mode=0777 0 0
--- End screen output ---

    # Display the mounted devices

    mount

+++ Begin screen output +++
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
--- End screen output ---

    # Reload the fstab file

    mount -a

    # Display the mounted devices

    mount

+++ Begin screen output +++
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//base/linux on /mnt/base_linux type cifs (rw,mand)
--- End screen output ---

    ls -l /mnt/base_linux

+++ Begin screen output +++
total 0
drwxrwxrwx 1 my_linux_username my_linux_username        0 Mar  4 22:10 db11g
-rwxrwxrwx 1 my_linux_username my_linux_username 89712640 Mar  4 22:02 oracle.tar
--- End screen output ---

    reboot

    # (Log onto the Linux machine with the root account)

    ls -l /mnt/base_linux

+++ Begin screen output +++
total 0
drwxrwxrwx 1 my_linux_username my_linux_username        0 Mar  4 22:10 db11g
-rwxrwxrwx 1 my_linux_username my_linux_username 89712640 Mar  4 22:02 oracle.tar
--- End screen output ---

    # Log onto the non-privileged Linux account

    su - my_linux_username

    # Display a directory of the files on the NTFS share

    ls -l /mnt/base_linux

+++ Begin screen output +++
total 0
drwxrwxrwx 1 my_linux_username my_linux_username        0 Mar  4 22:10 db11g
-rwxrwxrwx 1 my_linux_username my_linux_username 89712640 Mar  4 22:02 oracle.tar
--- End screen output ---

    # Write to the NTFS share

    touch /mnt/base_linux/temp.tmp

    # Display a directory of the files on the NTFS share--the write was a success

    ls -l /mnt/base_linux

+++ Begin screen output +++
total 0
drwxrwxrwx 1 my_linux_username my_linux_username        0 Mar  4 22:10 db11g
-rwxrwxrwx 1 my_linux_username my_linux_username 89712640 Mar  4 22:02 oracle.tar
-rwxrwxrwx 1 my_linux_username my_linux_username        0 Jul  6 00:21 temp.tmp
--- End screen output ---

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to mount nas-share using generated credentials (mount EC 13,32)

Heyas At home i have 1 nas with 3 shares, of which i used to mount 2 of them using a script with hardcoded password and username in it. EDIT: Turns out, its not the script, but 'how i access' the nas share.. (-o user=XY,password=... VS. -o credentials=...). Figured about credential files,... (0 Replies)
Discussion started by: sea
0 Replies

2. Windows & DOS: Issues & Discussions

Share NTFS for Backups

Hi, I would like to assign a 10TB LUN to multiple windows servers. On the LUN will be a folder assigned to each server to place its backup. Is there any change of data corruption with this setup. Thanks. (2 Replies)
Discussion started by: Mack1982
2 Replies

3. Red Hat

NFS mount read and write

Dear all, I have a server A and Client B. I am mounting a folder which is Server A using read and write options in client B. I have put entries in /etc/exports file as /mnt1/load *(rw,sync) In the client i cannot create any new file or delete any file eventhough it is read... (3 Replies)
Discussion started by: jegaraman
3 Replies

4. Red Hat

unable to mount windows share on linux 5.1

Hi, I am using redhat linux 5.1 - 64bit, using command mount -t cifs //192.192.192.192/SW/Ex /192.192.192.192 -o username=test I am getting below error. mount: block device //192.192.192.192/SW/Ex is write-protected, mounting read-only mount: cannot mount block device... (3 Replies)
Discussion started by: manoj.solaris
3 Replies

5. IP Networking

Can't see home folder on one NFS mount but can in another mount on another share

Hello, I have a few Ubuntu 9.10 laptops I'm trying to learn NFS sharing with. I am just experimenting on this right now, so no harsh words about the security of what I'm playing with, please ;) Below are the configs /etc/exports on host /home/woodnt/Homeschool... (2 Replies)
Discussion started by: Narnie
2 Replies

6. Linux

Mount ntfs in linux

How Can I mount Windows NTFS Partation in to Linux ? (4 Replies)
Discussion started by: Amit Deore
4 Replies

7. UNIX for Advanced & Expert Users

Mount Linux share onto Sco 5.0.6

I've got a Sco 5.0.6 box and an Ubuntu box on my network. i want to backup certain directories onto a share on the Ubuntu box. how do i mount a linux share onto the Sco box? (1 Reply)
Discussion started by: sall
1 Replies

8. UNIX for Dummies Questions & Answers

How do i access (mount, read & write) a floppy disk from the console, not being root?

welll, the title quite explains what i want to do thanks for your time! (4 Replies)
Discussion started by: kfaday
4 Replies

9. Linux

Mount W2K share on Redhat Linux

How do I mount a Windows 2K share on Redhat Linux? I tried this: mount -t smbfs -o username=administrator,password=mypassword //machine/share But it just returns the help for the mount command:( (3 Replies)
Discussion started by: Spetnik
3 Replies

10. UNIX for Advanced & Expert Users

Pb for mount a ntfs fs type

Hie , I have a distrib Red Hat with a kernel-2.4.9-31 . I can't mount a ntfs fs with command : #mount -t ntfs /dev/hda1 /windows mount: fs type ntfs not supported by kernel Why doesn't my kernel support a type ntfs ? How can I mount this FS ? Merci d'avance.. (1 Reply)
Discussion started by: Romeo_91
1 Replies
Login or Register to Ask a Question