The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Mount ntfs in linux Amit Deore Linux 4 09-26-2006 05:25 PM
Mount Linux share onto Sco 5.0.6 sall UNIX for Advanced & Expert Users 1 09-10-2006 02:32 PM
how to mount ntfs filesystem nicknihal Linux 0 09-09-2006 01:59 AM
How do i access (mount, read & write) a floppy disk from the console, not being root? kfaday UNIX for Dummies Questions & Answers 4 05-13-2005 08:17 AM
Mount W2K share on Redhat Linux Spetnik Linux 3 12-16-2003 04:13 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-05-2008
Registered User
 

Join Date: Dec 2007
Posts: 41
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
Reply With Quote
Forum Sponsor
  #2  
Old 07-05-2008
Registered User
 

Join Date: Dec 2007
Posts: 41
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?
Reply With Quote
  #3  
Old 07-06-2008
Registered User
 

Join Date: Dec 2007
Posts: 41
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 ---
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0