13

I am able to share files between two Ubuntu machine and Windows machine but I have these problems which I can't solve.

  1. When I share files between two Ubuntu machines via LAN Computer1 to Computer2. Do I need Samba on both machines? If no(relative to upper Question) then in case of transferring p2to
  2. When I access another Ubuntu Machine from Ubuntu, without defining file and directory permissions on Computer1 I see all files under / on Computer2. Is there any way to stop that visibility? How to set permissions on the folder or directory I want other users to be able to see? How to set a customized list of shared folders or files?
  3. Which user and password i use while accessing other Ubuntu machine samba user or system admin user ? is it work on both. can i use it without password ?
  4. How i share file without using GUI samba or using terminal .
  5. Why Computer2 is not getting shown on my network connection in Computer1 ?(without using connect to server option) why my linux system is not shwoing in this? Screenshot of Nautilus

  6. Finding other system without knowing name or IP over LAN?

Help me through this

7
  • bump need same help here too exact situation!! need to share two ubuntu for my xbmc on the laptop so i can access media on the other ubuntu machine and windows machine Jan 19, 2012 at 17:35
  • @SarveshLad : I stuck from at least last three week but nothing works . please make this question useful click on up mark . Jan 20, 2012 at 4:47
  • Some Good Explanation will be helpful Jan 20, 2012 at 4:52
  • i m now able to! using both NFS mounting and SSH accessing Jan 21, 2012 at 19:57
  • @guettli i got the answer of my 4 question Jan 25, 2012 at 17:13

3 Answers 3

22
+100

First of all: if you want to share files, there are several different protocols of interest: Samba (SMB), NFS, FTP, SSH/sFTP/SCP. Samba is the easiest if a Windows computer is involved, but you can use it also between two Ubuntu (and even Mac OS) machines. SSH is a nice thing for Ubuntu, because it's a very powerful tool - e.g. running rsync over SSH is a command method to keep two directories synchronised. But I'd choose SMB because you mention Windows and probably setting up one protocol/server is enough for the beginning.

Only three important hints for further research about other protocols:

  • Think about encryption - is it necessary that the protocol is encrypted or do you want to trust your LAN? (FTP is not encrypted, SSH/sFTP/SCP is)
  • Do need to transfer huge files? (SCP is really slow compared to SMB in Gigabit networks! Google benchmarks if you are interested.)
  • Is it necessary to keep the file permissions of the files transferred?

Now your questions:

1. When I share files between two Ubuntu machines via LAN, do I need Samba on both machines?

No, not the Samba server. There will be always a server and a client. You can access the shared folders on the server from the client - not the other way around. In other words: the copying progress bar will be always on the client, never on the server. But with two Ubuntu machines, both of them can be client and server at the same time, if you want. The client is shipped with Ubuntu per default, the server is installed automatically when you share a folder for the first time with Nautilus.

2. Without Defining permission on computer 1 I can see all files under / on computer 2. Is their any way to stop that visibility?

That's not true for SMB/Samba. There are certain shared folders and only these are visible to the clients. Check the folder /var/lib/samba/usershares/ and the file /etc/samba/smb.conf, if the path / is shared. Probably you are connecting with SSH and not with SMB. Then you are right, usually everything is visible and you have to set the file and directory permissions correctly. You can find more details about this here: Simple & easy way to jail users

3. Which user and password do I have to use while accessing other Ubuntu machine through Samba?

Usually it's simple: just use any user and password of the other machine. Only in very special cases the user's normal password differs from his Samba password. You can change the Samba password separately with the command smbpasswd, but you should really have good reasons to use two different passwords.

You can allow shares without password. There are many things to say about this, but probably this Nautilus screenshot helps for the beginning:

enter image description here

4. How to share files without GUI using the terminal?

The most common use case is SSH/SCP then probably. Just type the following in the client's terminal to copy /path/to/file1 on the client to /path/to/file2 on the server:

scp /path/to/file1 server:/path/to/file2

server can be an IP address or a domain name. Or another method already mentioned in other answers with rsync:

rsync /path/to/file1 server:/path/to/file2

With Samba you probably would use smbmount (which is not shipped with Samba per default) in order to mount a network share on the client. Then you can use it normally. There are many ways to mount a Samba share. If you are using Gnome, gvfs-mount might be the easiest method:

gvfs-mount smb://server/nameOfsharedFolder
cd ~/.gvfs/*

5. Why is the server not showing up in Nautilus / Network on the client?

As far as I know, the first time it doesn't show up there. After connecting to it once, you'll find it there. The first time, you will have to click "Windows Network", then "Workgroup" and then you'll see your server - hopefully. At least this was the result of my tests.

6. How to find the other system without knowing name or IP of the other system in LAN?

You can use nmap in the terminal, for example:

nmap 192.168.0.*

if 192.168.0.0 is your LAN. This will print you all network clients in your LAN (which can be discovered). Sometimes this might help, if other machines don't show up under Network.

5
  • very thanks 2 u really give me a good answer to all of my question ... about which u not understanding i will posting screenshot for that Jan 26, 2012 at 13:25
  • Great write-up! Re Q5, I think that you need the full samba installed on the client to auto-detect the network, although 'Connect to server' always works if you know the address. I've not read this anywhere, but I seem to recall experiencing this. I could be making it up though.
    – ams
    Jan 26, 2012 at 13:48
  • @ams That's strange! I tried it with a fresh live system (for the client) and added the results to my answer. Please edit/comment, if this is not true for you!
    – lumbric
    Jan 26, 2012 at 18:27
  • @lumbric: thanks but Q5 yet not resolved . if u find something new regarding Q5 then please edit ur answer . Jan 27, 2012 at 7:42
  • @Gaurav_Java Sorry, I couldn't figure out anything else to solve Q5. Also after the first connect, your server doesn't show up the next time?
    – lumbric
    Jan 29, 2012 at 21:03
1

Question4: to copy files between two ubuntu-pc you can use scp or rsync. Or you can mount directories from p1 on p2 with sshfs. this can be done using terminal

Question2: How do you access other Ubuntu Machines? If you don't want other people to read your files you can use this:

chmod -R o-rwX,g-rwX my-directory

But of course the root use can read them.

0
1

The simplest sharing app is Giver - minimum configuration is required

2
  • Unfortunately didn't worked in my proxyfied environment. But indeed, the simplest LAN share app ever. Jan 26, 2012 at 13:29
  • @AndrejsCainikovs yes, this app is intended for LAN use only Jan 26, 2012 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .