Difference between revisions of "SharingToLinux"

From Amahi Wiki
Jump to: navigation, search
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Connecting to a Server by Mounting your HDA =
+
== Connecting to a Server by Mounting your HDA ==
  
 
I was having trouble in Ubuntu accessing my network drives. I used "Connect to server..." under "Places" and I was able to access the files fine until I needed to access them in Firefox or other programs to upload them.
 
I was having trouble in Ubuntu accessing my network drives. I used "Connect to server..." under "Places" and I was able to access the files fine until I needed to access them in Firefox or other programs to upload them.
Line 5: Line 5:
 
It was explained to me that it's being mounted via Nautilus and that's not truely "mounted" in the linux sense.
 
It was explained to me that it's being mounted via Nautilus and that's not truely "mounted" in the linux sense.
  
Here's the resolution.
+
Here's the resolution. (for each boot into linux)
  
 
NOTE: you may need to install smbfs first with
 
NOTE: you may need to install smbfs first with
Line 20: Line 20:
 
I used the following commands (of course, replace the username with your username unless you are also kevin):
 
I used the following commands (of course, replace the username with your username unless you are also kevin):
  
sudo mount.cifs '\\hda\music' Music -o user=kevin
+
sudo mount.cifs '\\hda\Music' Music -o user=kevin
  
sudo mount.cifs '\\hda\pictures' Pictures -o user=kevin
+
sudo mount.cifs '\\hda\Pictures' Pictures -o user=kevin
  
sudo mount.cifs '\\hda\docs' Documents -o user=kevin
+
sudo mount.cifs '\\hda\Docs' Documents -o user=kevin
  
sudo mount.cifs '\\hda\movies' Videos -o user=kevin
+
sudo mount.cifs '\\hda\Movies' Videos -o user=kevin
  
 
And that was it. Now the files in Amahi are mounted as if they are local files on my computer.
 
And that was it. Now the files in Amahi are mounted as if they are local files on my computer.
Line 34: Line 34:
 
Keep in mind, this does not auto-mount so you would have to do this again each time you boot to linux. An auto-mount solution would be helpful.
 
Keep in mind, this does not auto-mount so you would have to do this again each time you boot to linux. An auto-mount solution would be helpful.
  
'''Permanent mount:'''
+
 
Tested under Ubuntu 8.10, All the credit for this belongs to dmizer. I simply adapted to the hda. [http://ubuntuforums.org/showthread.php?t=288534 Original thread here]
+
----
 +
 
 +
 
 +
==Permanent mount:==
 +
Tested under Ubuntu 9.10, All the credit for this belongs to dmizer. I simply adapted to the hda. [http://ubuntuforums.org/showthread.php?t=288534 Original thread here]
 
In this example we will mount the hda's shared music on our desktop. It will appear as a drive.
 
In this example we will mount the hda's shared music on our desktop. It will appear as a drive.
 +
Also Works fine under Fedora 14/15/16 as well, minus the Ubuntu-specific commands below (such as 'aptitude'). You may need to install samba and cifs utilities in Fedora. (May 28, 2012)
  
*First create a new folder to mount your hda files: '''sudo mkdir /media/music'''
+
NOTE: you may need to install smbfs first with
 +
 
 +
sudo aptitude install smbfs
 +
 
 +
*First create a new folder to mount your hda files: '''sudo mkdir /media/Music'''
 
*We need to create a credential file to mount on startup: '''sudo nano /root/.smbcredentials'''
 
*We need to create a credential file to mount on startup: '''sudo nano /root/.smbcredentials'''
 
**Add the following lines:  (You must change hda_username and hda_password to the correct user name and password for the hda to connect to):
 
**Add the following lines:  (You must change hda_username and hda_password to the correct user name and password for the hda to connect to):
Line 45: Line 54:
 
*Save the file by hitting ctrl+x, type "y" to save the buffer, and <enter> to exit.
 
*Save the file by hitting ctrl+x, type "y" to save the buffer, and <enter> to exit.
 
*Now, change the permissions of the file so only root can read and edit it:
 
*Now, change the permissions of the file so only root can read and edit it:
'''sudo chmod 700 /root/.smbcredentials'''
+
'''sudo chmod 700 /root/.smbcredentials'''
*Let's back up our fstab: '''sudo cp /etc/fstab /etc/fstab_old'''
+
*Let's back up our fstab:  
** If needed you may return to the original this way: '''sudo mv /etc/fstab_old /etc/fstab'''
+
sudo cp /etc/fstab /etc/fstab_old
 +
* If '''needed''' you may return to the original this way:
 +
sudo mv /etc/fstab_old /etc/fstab  
 
*Now we edit fstab:
 
*Now we edit fstab:
'''sudo nano /etc/fstab'''
+
'''sudo nano /etc/fstab'''
 
*Add this line at the end:
 
*Add this line at the end:
'''//hda/music  /media/music  cifs credentials=/root/.smbcredentials,iocharset=utf$'''
+
'''//hda/Music /media/Music cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0'''
   
+
*For those of you who want to have your music on the server mounted as if it were in your local /home/Music folders, add this line:
 +
  '''//hda/Music /home/USERNAME/Music cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0'''
 +
 
 +
'''For Ubuntu 9.10 user (Karmic)''' There is a [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/406466 bug reported], that will prevent opening the files:  Files owned by root / "The folder contents could not be displayed"
 +
The fix use this, instead to edit the fstab file:
 +
 
 +
  '''//hda/Music /home/USERNAME/Music cifs credentials=/root.smbcredentials,iocharset=utf8,noserverino,gid=1000,uid=1000,nounix,file_mode=0777,dir_mode=0777 0 0'''
 +
 
 +
*Save the file when done adding any other share folders by hitting ctrl+x, type "y" to save the buffer, and <enter> to exit.
 +
*be sure to replace USERNAME with your Ubuntu username.
 +
*Repeat accordingly for Videos, Pictures etc.
 
*Finally, test your settings to make sure they work:
 
*Finally, test your settings to make sure they work:
'''sudo mount -a'''
+
 
 +
'''sudo mount -a'''
  
 
Take a deep breath, and mounted drive should appear on your desktop.
 
Take a deep breath, and mounted drive should appear on your desktop.
 
  
 
'''On my system, the shutdown halted with a cifs/ vfs error.'''
 
'''On my system, the shutdown halted with a cifs/ vfs error.'''
Line 65: Line 86:
 
  '''sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh'''
 
  '''sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh'''
 
  '''sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh'''
 
  '''sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh'''
 
= Connecting to a Server with the File Browser =
 

Latest revision as of 18:38, 6 August 2013

Connecting to a Server by Mounting your HDA

I was having trouble in Ubuntu accessing my network drives. I used "Connect to server..." under "Places" and I was able to access the files fine until I needed to access them in Firefox or other programs to upload them.

It was explained to me that it's being mounted via Nautilus and that's not truely "mounted" in the linux sense.

Here's the resolution. (for each boot into linux)

NOTE: you may need to install smbfs first with

sudo aptitude install smbfs

I opened up a terminal window. In my user folder, there were already folders called "Music", "Pictures", "Documents" and "Videos". I wanted to use those folders so I didn't have to create more. If they didn't exist though, they could be created using the command:

mkdir Music

Then of course repeat the command replacing the word "Music" with "Pictures" "Documents" and "Movies" or "Videos".

Now time to mount. I used the following commands (of course, replace the username with your username unless you are also kevin):

sudo mount.cifs '\\hda\Music' Music -o user=kevin

sudo mount.cifs '\\hda\Pictures' Pictures -o user=kevin

sudo mount.cifs '\\hda\Docs' Documents -o user=kevin

sudo mount.cifs '\\hda\Movies' Videos -o user=kevin

And that was it. Now the files in Amahi are mounted as if they are local files on my computer.

Just to check, I opened up Firefox, logged into Gmail, composed a new message and clicked "Attach a file" then "Browse". Sure enough, the files were all there.

Keep in mind, this does not auto-mount so you would have to do this again each time you boot to linux. An auto-mount solution would be helpful.




Permanent mount:

Tested under Ubuntu 9.10, All the credit for this belongs to dmizer. I simply adapted to the hda. Original thread here In this example we will mount the hda's shared music on our desktop. It will appear as a drive. Also Works fine under Fedora 14/15/16 as well, minus the Ubuntu-specific commands below (such as 'aptitude'). You may need to install samba and cifs utilities in Fedora. (May 28, 2012)

NOTE: you may need to install smbfs first with

sudo aptitude install smbfs
  • First create a new folder to mount your hda files: sudo mkdir /media/Music
  • We need to create a credential file to mount on startup: sudo nano /root/.smbcredentials
    • Add the following lines: (You must change hda_username and hda_password to the correct user name and password for the hda to connect to):
username=hda_username                                                        
password=hda_password
  • Save the file by hitting ctrl+x, type "y" to save the buffer, and <enter> to exit.
  • Now, change the permissions of the file so only root can read and edit it:
sudo chmod 700 /root/.smbcredentials
  • Let's back up our fstab:
sudo cp /etc/fstab /etc/fstab_old
  • If needed you may return to the original this way:
sudo mv /etc/fstab_old /etc/fstab 
  • Now we edit fstab:
sudo nano /etc/fstab
  • Add this line at the end:
//hda/Music /media/Music cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
  • For those of you who want to have your music on the server mounted as if it were in your local /home/Music folders, add this line:
//hda/Music /home/USERNAME/Music cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

For Ubuntu 9.10 user (Karmic) There is a bug reported, that will prevent opening the files: Files owned by root / "The folder contents could not be displayed" The fix use this, instead to edit the fstab file:

//hda/Music /home/USERNAME/Music cifs credentials=/root.smbcredentials,iocharset=utf8,noserverino,gid=1000,uid=1000,nounix,file_mode=0777,dir_mode=0777 0 0 
  • Save the file when done adding any other share folders by hitting ctrl+x, type "y" to save the buffer, and <enter> to exit.
  • be sure to replace USERNAME with your Ubuntu username.
  • Repeat accordingly for Videos, Pictures etc.
  • Finally, test your settings to make sure they work:
sudo mount -a

Take a deep breath, and mounted drive should appear on your desktop.

On my system, the shutdown halted with a cifs/ vfs error.

wyley.r's post solved my problem. In a terminal:

sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh