Software & AppsOperating SystemLinux

Sharing Files in LAN: Samba vs SSH on Ubuntu – FAQs Answered

Ubuntu 4

In the world of Ubuntu, sharing files over a Local Area Network (LAN) can be accomplished using two primary methods: Samba and SSH. This article aims to answer some frequently asked questions about these two methods, helping you decide which one is best suited for your needs.

Quick Answer

Samba and SSH are two different methods for sharing files over a LAN on Ubuntu. Samba is best suited for mixed OS environments and allows for easy sharing and access of files. SSH, on the other hand, is a secure tool primarily used in Linux-only environments for secure file transfers. The choice between the two depends on your specific needs and environment.

Samba vs SSH

Samba is a free software re-implementation of the SMB networking protocol, providing file and print services for various Microsoft Windows clients. It’s an ideal solution if you’re working in a mixed OS environment.

On the other hand, SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network. It’s a powerful tool for secure file transfers, often used in a Linux-only environment.

Samba FAQs

Do I need Samba on both machines?

No, Samba only needs to be installed on the machine that will be sharing the files. The other machine can access the shared folders using the Samba client, which is pre-installed on Ubuntu.

How to stop visibility of all files under / on the other machine?

By default, Samba only shares specific folders, not the entire file system. You can define the shared folders in the /etc/samba/smb.conf file on the machine that is sharing the files. For example:

[share]
 path = /path/to/share
 available = yes
 valid users = user1 user2
 read only = no
 browsable = yes
 public = yes
 writable = yes

In this example, path is the directory you want to share, valid users are the users who can access the share, and read only, browsable, public, and writable control the permissions for the shared folder.

Which user and password to use while accessing other Ubuntu machine through Samba?

You can use any user and password from the other machine. In most cases, the Samba password is the same as the user’s normal password. However, you can change the Samba password separately using the smbpasswd command.

SSH FAQs

How to share files without using GUI or using the terminal?

If you want to share files without using a GUI, you can use the terminal. For example, you can use the scp command to copy files between two Ubuntu machines over SSH. Here’s an example:

scp /path/to/local/file user@remote:/path/to/remote/file

In this command, scp is the secure copy command, /path/to/local/file is the file you want to copy, user is the username on the remote machine, and remote is the IP address or hostname of the remote machine.

Why is the other machine not showing up in Nautilus / Network?

The other machine may not show up in Nautilus / Network if the necessary services are not running or if there are network connectivity issues. Make sure that the Samba service is running on the machine that is sharing the files. You can also try connecting to the other machine using the “Connect to Server” option in Nautilus and entering the IP address or hostname of the remote machine.

How to find other systems without knowing their names or IPs on the LAN?

You can use the nmap command in the terminal to scan for other systems on the LAN. For example:

nmap 192.168.0.*

This command will scan and show you all the network clients in your LAN that can be discovered.

Conclusion

When it comes to sharing files over LAN on Ubuntu, both Samba and SSH have their strengths. Samba is ideal for environments with mixed operating systems, while SSH is a powerful and secure tool for Linux-only environments. The choice between the two will depend on your specific needs and environment.

Can Samba be used to share files between Ubuntu and Windows machines?

Yes, Samba can be used to share files between Ubuntu and Windows machines. Samba provides file and print services for various Microsoft Windows clients, making it ideal for a mixed OS environment.

Do I need to install SSH on both machines to share files using SSH?

Yes, SSH needs to be installed on both machines to share files using SSH. SSH is a cryptographic network protocol, and both the client and server components are required for secure file transfers.

How secure is file sharing using Samba?

Samba supports various security features, including user authentication and encrypted communication. However, it’s important to configure Samba correctly and keep it up to date to ensure the security of your file sharing.

Can SSH be used for file transfers between Ubuntu machines only?

Yes, SSH can be used for file transfers between Ubuntu machines only. SSH is commonly used in Linux-only environments for its powerful and secure file transfer capabilities.

Can Samba be used to share specific folders only?

Yes, Samba allows you to share specific folders by defining them in the smb.conf file. This configuration file lets you specify the exact directories you want to share and control the permissions for each shared folder.

How can I change the Samba password separately from the user’s normal password?

You can change the Samba password separately using the smbpasswd command. This command allows you to set or update the Samba password for a specific user.

What is the command to copy files between Ubuntu machines using SSH?

The command to copy files between Ubuntu machines using SSH is scp. For example: scp /path/to/local/file user@remote:/path/to/remote/file. This command securely copies the specified file from the local machine to the remote machine.

How can I find other systems on the LAN without knowing their names or IPs?

You can use the nmap command in the terminal to scan for other systems on the LAN. For example, nmap 192.168.0.* will scan and display all the network clients in your LAN that can be discovered.

Leave a Comment

Your email address will not be published. Required fields are marked *