You are reading the article How To Mount Remote Directories In Linux With Sshfs updated in December 2023 on the website Cattuongwedding.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 How To Mount Remote Directories In Linux With Sshfs
There’s certainly no shortage of solutions when it comes to syncing files between two devices. While Google Drive and Microsoft OneDrive may not give you official Linux clients, NextCloud and others do. But maybe you don’t trust a big corporation to store your files. Or, maybe, you want more security than NextCloud offers. With all the components that go into building something like NextCloud, chances are it has more undiscovered security holes than simpler solutions.
Why Use SSHFS?From the end-user perspective, this is very easy to use, clean and simple. It’s also incredibly secure since it relies on the battle-hardened and proven OpenSSH server. Encryption is also top notch, so you can rest assured that no one can steal your files while they are in transit. A correctly configured up-to-date server that only listens for SSH connections is usually impossible to crack for all but the most skilled attackers (think NSA, security specialists, etc.). And they probably don’t want your files.
Why You Wouldn’t Want to Use SSHFSIf you want the best possible transfer speed, you might want to use other solutions such as NFS. SSHFS is not the slowest if your Internet connection is of high quality, but it’s not the fastest either. And if you want to transfer directories that contain hundreds of small files, it becomes horrible. Also, if you want to fine-tune file sharing settings, based on individual users or other factors, you might want to use other software.
To summarize, if all you need is an easy, secure way to synchronize a remote directory with a local one and aren’t in a huge hurry, you will probably be satisfied with this solution.
Install SSHFSOn Arch Linux based installations, use this command:
sudo
pacman-S
sshfs
If you’re on a Fedora-based distro, use:
sudo
dnf
install
sshfs
On Debian, Ubuntu and family, use:
sudo
apt
install
sshfs
For those of you that use OpenSUSE, enter this command:
sudo
zypperinstall
sshfs
Server ConfigurationIf you rent a server or VPS, the OpenSSH server daemon is already configured. Follow the steps recommended by your cloud service provider to configure a regular user (non-root). Some let you do this directly from their web control panel and even let you import the public key to allow SSH access. In this case, generate the key pairs locally, with the ssh-keygen command. After, import the public key from “/home/your_username/.ssh/id_rsa.pub.”
If the cloud provider doesn’t offer a tool to easily import SSH public keys, do it manually. At the very least, disallow root login and disable password logins. Use SSH keys exclusively instead: they are impossible to brute-force, as is the case with passwords.
If you want to sync files between two computers at home, just treat one as the server (install openssh-server package and configure) and the other one as the client. The same steps apply.
Mount a Remote Directory Locally with SSHFSFirst, create a directory that will be synced with the remote side.
mkdir
$HOME
/
sshfs
Next, mount the remote directory locally through SSHFS. Replace “user” with the actual username created on your server and “203.0.113.1” with the actual IP address of your remote instance.
sshfs
user@
203.0.113.1:/
home/
user$HOME
/
sshfs
Of course, if you don’t want to sync the entire home directory of the user on the server side, just replace “/home/user” with “/home/user/some_other_directory” after you create it on the server.
When you want to unmount, use this command:
cd
&&
fusermount-u
$HOME
/
sshfs
ConclusionHopefully this covers all your needs. But, if it doesn’t, you can read about more command line options in the online SSHFS manual.
Alexandru Andrei
Fell in love with computers when he was four years old. 27 years later, the passion is still burning, fueling constant learning. Spends most of his time in terminal windows and SSH sessions, managing Linux desktops and servers.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.
You're reading How To Mount Remote Directories In Linux With Sshfs
How To Easily Diagnose Your Network With Mtr In Linux
The tool is called MTR, for Matt’s Traceroute. It’s named after Matt Kimball, the original developer. Roger Wolff has been the maintainer since 1998.
MTR combines the functions of both the standard programs ping and traceroute. Like ping, it sends ICMP requests to a destination, either a domain name or an IP address, and listens for the destination to answer back. Like Traceroute, it also works by setting the Time To Live (TTL), or the number of maximum hops a packet can take over the network, to a low number, increasing with each attempt. This determines the route packets are taking to a destination along the way. The information will update continuously for as long as MTR runs.
InstallationInstalling it is easy enough. If you’re on a Debian/Ubuntu system just type:
sudo
apt-get install
mtrFor other distro that doesn’t include MTR in its repository, you can download the source code and compile it with the command:
./
configuremake
make
install
UsageMTR works in two modes, a graphical mode that users who aren’t as comfortable with the command line can work with more easily, and in a text-based mode.
Using MTR is pretty easy. If you wanted to test Google, you’d just use this command:
mtr chúng tôi version in Ubuntu comes with a graphical interface. When you start MTR, the results will pop up in a window. If you’d rather have it in your terminal window like most Linux users, you have several options.The easiest way is to call MTR with the “--curses” switch:
mtr--curses
chúng tôi that’s too much for you as well, you can download the plain text version:sudo
apt-get install
mtr-tinyIf you want the graphical bells and whistles (although there really aren’t any in MTR), just use the “--gtk” option.
If you want to test an IP address instead of a hostname, use the “--address” option:
mtr--address
127.0.0.1Of course, this will test the loopback device, or in other words, your own machine. You can use any IP address you want. It can be useful in case your DNS ever gets hosed.
You can also do some interesting things like change the display node and the way the fields are represented.
Linux is a great platform for learning how the Internet really works, and it’s due in no small part to the availability of tools like MTR. While sophisticated networking tools can cost thousands of dollars on other platforms, you can find quality tools to diagnose and troubleshoot connections available for free on Linux.
Image credit: Medical Instrument With Computer by BigStockPhoto
David Delony
David Delony is a writer for Make Tech Easier
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.
How To Setup Firewall In Linux?
Firewalls are an integral component of every contemporary computer system, safeguarding the network and protecting the system from illegal access. We’ll take a deep dive into the realm of Linux firewalls and learn how to configure one in this post.
Before we involve into the technical details of establishing a firewall in Linux, let us clarify what a firewall is and why it is so important!
A firewall is a network security device that monitors and restricts network traffic based on predefined security rules. A firewall’s principal function is to block unauthorised access to a computer system or network while still allowing authorised access. It functions as a gatekeeper, controlling who and what may enter and depart a network.
There are two major choices for configuring a firewall in Linux: iptables and firewalld.
‘iptables’ is a command-line programme for managing the Linux kernel firewall. For many years, it was the default firewall for Linux servers and is still extensively used today.
‘firewalld’ is a more modern approach to managing firewalls in Linux. It is a dynamic daemon that provides a D-Bus interface for managing firewall rules, and it is used by many Linux distributions as the default firewall.
Now let’s dive into the steps required to set up a firewall in Linux using both iptables and firewalld.
Using ‘iptables’ to Create a Firewall
To begin setting an iptables firewall, first ensure that it is already installed on your system. Although iptables is present in most Linux distributions, it is always a good idea to double-check.
Open a terminal and type the following command to see if iptables is installed on your system: sudo iptables -L
If iptables is not already installed on your machine, use the following command to install it: sudo apt-get install iptables
You may begin setting the firewall once you have validated that iptables is installed on your system.
The initial step in iptables configuration is to establish the default policies for incoming and outgoing traffic. The default policy determines what happens to packets that do not match any of the rules in the firewall.
To set the default policies to drop all incoming and outgoing traffic, run the following commands −
sudo iptables -P INPUT DROP sudo iptables -P OUTPUT DROP
Once you have set the default policies, you can start adding rules to allow or block specific types of traffic. The basic syntax for adding a rule to iptables is as follows −
sudo iptables -A [CHAIN] -p [PROTOCOL] --dport [PORT] -j [ACTION]Let’s break down the components of the rule −
CHAIN − This specifies the chain in the firewall where the rule will be added. The three default chains in iptables are INPUT, OUTPUT, and FORWARD.
PROTOCOL − This specifies the protocol for the traffic. Common protocols include TCP, UDP, and ICMP.
PORT − This specifies the port number for the traffic.
ACTION − This specifies what should happen to traffic that matches the rule. Common actions include ACCEPT, DROP, and REJECT.
The following command, for example, would accept incoming SSH traffic (port 22) on the INPUT chain −
sudo iptables -A INPUT -p tcp —dport 22 -j ACCEPTSimilarly, the following command would enable OUTPUT chain HTTP traffic (port 80) −
sudo iptables -A OUTPUT -p tcp —dport 80 -j ACCEPT Using ‘firewalld’ to Create a FirewallAnother option for setting up a firewall in Linux is by using firewalld. Firewalld is a modern dynamic daemon that is used by several Linux distributions, such as CentOS, Fedora, and Red Hat Enterprise Linux, as the default firewall management tool.
The first step in configuring a firewall with firewalld is to see if it is already installed on your system.
Most recent Linux distributions come with firewalld pre-installed, however you may validate its presence in the terminal by typing the following command −
sudo firewall-cmd —stateIf firewalld is not already installed on your machine, use the following command to install it: sudo yum install firewalld
Once you confirmed that firewalld is installed on your system, you start configuring the firewall.
The first step in configuring firewalld is to check the default zone. The default zone is a predefined set of rules that govern the traffic allowed on the system. To check the default zone, run the following command −
sudo firewall-cmd --get-default-zoneBy default, the default zone is set to “public”. You can change the default zone by running the following command −
sudo firewall-cmd --set-default-zone=zonewhere “zone” is the name of the zone you want to set as default.
To allow incoming HTTP traffic, for example, you can use the following command −
The “–permanent” option makes the rule permanent, so it survives a reboot. If you do not use the “–permanent” option, the rule will be removed when the system is rebooted.
You can also allow specific ports by using the “–add-port” option. For example, the following command allows incoming traffic on port 22 for SSH −
sudo firewall-cmd --add-port=22/tcp --permanentAfter adding the necessary rules, make sure to reload the firewall for the changes to take effect −
sudo firewall-cmd --reloadMigrating To Linux With Vendor
An impulsive and immediate migration to Linux can sometimes lead to disappointment. Ambitious businesses are sometimes led to believe that their data can merely be be dumped from one platform onto another, but the reality is a little more complex than this. In order for a migration to be successful, one needs to be familiar with native Linux applications, and the data needs to be stored in a format that is independent from just a single application.
Changing one’s favorite application can be hard. Everyone resists the introduction of new things, especially when they threaten and have direct impact on the force of habit. For a very long time, large and well-established software vendors have capitalized on people’s reluctance to learn new processes, such as identification and menu items and familiarity with user interfaces. Some software vendors went further and defended these processes by introducing the notion of ownership, then essentially patenting behavior. Even more software vendors used the idea of obscurity to restrict (or altogether eliminate) people’s ability to change. This is known as lock-in.
Many of these issues can easily be addressed when transparency is embraced. Moreover, sharing of information facilitates more rapid development of knowledge. It speeds up improvement where all peers involved can move forward in harmony, without jeopardising unity and conformity.
A single unified format is the key with which various businesses can communicate conveniently. It is also highly essential for the enhancement of the existing formats, which should preferably remain party-neutral, backward compatible, complete, and elegant. In a world of unified formats, different businesses are able to compete with one another not through restriction or punishment of rival developers and consumers, but rather through innovation, added value, reasonable cost, and a decent level of support. For example, in the case of documents, one unified format is currently OpenDocument format (ODF), and for static documents, Portable Document Format (PDF) has become the norm.
The dawn of the GNU/Linux operating system was a time when the software industry had already evolved (or devolved) into a predatory marketplace. This market was fragmented and isolated. Different software vendors strived to capture their costumers using proprietary formats. Corel, for example, was happy enough treating its popular word processor as though it did not need to interoperate seamlessly with rival software. IBM was no exception. In later years, especially in the United States, software vendors added extra protection to their offerings by making not only their application code a property, but also the ideas behind it. Ownership could then be associated even with mathematical notions. That is the effect of software patents. This shields vendors and yields nothing but nervousnous for competitors and customers. Perceived risk and dependency can be worrisome indeed.
Years passed on and people accumulated data. Inability to access older data, which is related but not identical to digital preservation, opened many people’s eyes. For example, consider the case where a person loses metadata that accompanies photos if moved from one application to another or one file system to another (a common scenario when changing or upgrading an operating system). Suddenly, people’s personal information — including memories with sentimental value — became obsolete and no longer accessible. In some cases, the effort required to regain access to information was just too great to be worth handling. People learned to accept losses, but they also realized that there was a different way — a better way even.
This awakening led to a reform, at least at a mental level. People began bothering to check which formats they can and cannot rely on. Formats were associated with trust and perceived as an important factor. Some people went further and demanded software for which all source code was available.
To enable wider access, various formats such as Portable Document Format (PDF) were formally standardized. Tight control of this these formats was conceded. In turn, new formats were created which also remained independent from applications and companies. One such format is OpenDocument Format (ODF), which is now widely recognized as an international (ISO-approved) standard for documents.
The introduction of a limited set of formats that multiple vendors can work with has resolved notorious and much-loathed (by the customer, not the vendor) issues, most notably lock-in. Backing from international organizations meant that these formats were by no means formalized to benefit one application or one operating system. No company was truly in control of the process. Portability was improved at the application level and the operating system level. People who prefer different platforms — whether an application or the underlying operating system — were able to exchange information at ease and also in a non-lossy fashion. This improved productivity for various reasons.
First among those reasons is personal convenience. There is no one piece of software that suits everyone. There is no parity in user expertise due to level of experience and various backgrounds (including training and education). Different people think differently and thrive in individual strengths. A programmer, for example, might be able to handle technical complexity, whereas a writer can express himself or herself in a clear and eloquent fashion. Any technical peril you put in a writer’s face might simply become a distraction and obstruction – simplification enables a writer to be more focused.
The second reason why a unified format solves and addresses many problems has to do with the fact that it eliminates the need to transform and translate of data from one format to another. The data is contained in a form which is defined by one “gold standard.” It is a case of abstraction, or separation into layers. Data becomes entirely independent from the application that supports it.
Having identified reasons why no single application suits everyone, one can look at the needs of a business. Businesses must standardize on formats, not software. Formats are verbal and technical specifications, not code. As long as the specifications remain unchanged or evolve in an open, transparent, and carefully monitored fashion, business information is secure. It preserves its integrity in the long term. Businesses, moreover, needn’t rely on one particular vendor anymore. It puts the businesses in charge of their financial destiny and puts their data in the hands of responsible, supervised, and peer-reviewing industry consortia.
How To Rename A File In Linux
When you start learning something new, even the simplest tasks feel confusing, and that can be frustrating for anyone. Say renaming a file is one of the most basic tasks for file management, but newbies might face difficulty in renaming a file or batch renaming files in Linux. To help you with it, we have explained four easy ways to rename a file or even multiple files in Linux using the command line interface (CLI) as well as the GUI.
Renaming Files in Linux (2023)First, we will explain how to use the mv and rename commands to rename files using the Command Line (or Terminal) in Linux. And then, we will learn how to rename or batch rename files using GUI tools, including GPRename and the native file manager in your Linux distro.
Rename Files Using the Command LineEven though using the command line for the simplest of tasks might sound intimidating at first, it boasts a lot of features and is the fastest way to rename files in Linux. Here, we are using the mv and rename commands, and both of them will work in any Linux distribution.
Rename Files Using mv CommandThe mv command stands for “move” with its primary purpose being to move both files and directories in the Linux file system. But we can also use the mv command to rename files. The syntax for the mv command is:
Note: If you use any of the -i, -f, -n flags more than once, only the final one takes effect.
Rename Single File Using the mv CommandTo rename a single file using the mv command, use the below-given syntax:
The command results in the output below as confirmation, and you can verify the changes made using the ls command.
In the above example, we are renaming the file “mini-course-10.pdf” to “test-1.pdf” using the mv command. Here, the syntax looks like this:
mv -v chúng tôi test-1.pdf
After that, you can verify the change from the output of the mv command (highlighted in the image above), or you can further verify the output using the ls command. You will see the renamed file in the list of files in that directory.
Rename Multiple Files using the mv CommandThe mv command can also be used to rename multiple files in a directory with some modifications. Here we will use some new commands along with the mv command. The command can prove to be difficult to understand with just raw syntax, so we have used it as an example below.
for i in *.pdf;do mv -v "$i" "${i/${i:0:4}/example}" done Rename Files Using rename CommandThe rename command solves the complexity of the mv command with easy-to-use syntax for both single and multiple file renaming. The rename command generally comes pre-installed on most distros. If not, you can easily install it using a simple command:
For Debian-based systems –
sudo apt install rename
For Fedora-based systems –
sudo yum install prename
For Arch-based systems –
sudo pacman -S install rename
Since the rename command uses Perl in the backend, there are three types of regular expressions – match, substitute, and translate in Perl. The rename command uses the “substitute” and “translate” regular expressions. In the syntax above, the “s” is used to specify that you will use the substitute expression.
For RedHat, Fedora-based systems, you need to use the following command syntax:
OptionsDescription-vShows information about the current operation-nstands for “no action” and is used for testing to see how the files are going to get affected after the operation-fused to force overwrite the file name
Rename a Single FileThe rename command works much like the mv command when renaming a single file. To rename a single file, use the following syntax:
Rename Multiple Files Rename Files PartiallySuppose you have used spaces in all your file names, and now, you want to replace the spaces with underscores. You can use the rename command and convert spaces to underscores using the syntax shown below:
For the above situation to replace spaces with underscores, use the given command:
Here, the is used to treat the underscore as a character and not a part of the command syntax.
Change The Case of The FilenamesWith the rename command, you can even replace the lowercase characters with their respective uppercase characters and vice versa. To replace the lowercase characters with uppercase ones, use the following syntax:
And to replace uppercase characters with lowercase ones, use this syntax:
Rename Files using the GUI in LinuxThe GUI method is probably a boon for those users who find the command line daunting. For the GUI method, we are using the Nautilus File manager and GPrename in Ubuntu 20.04 LTS, but rest assured that these methods will work on any distribution – albeit with slight modifications in some.
Rename Files Using File ManagerThis is one of the easiest methods to rename files in Linux. Every Linux desktop distribution comes pre-installed with a file manager such as Nautilus, Dolphin, Thunar, etc. We have explained how you can use these file managers to rename files, so keep reading.
Rename A Single File Rename Multiple Files Using File Manager2. In this context menu, select the “Rename” option. Or, you can press the F2 button on the keyboard to access the rename option.
3. This will open a new rename window, as shown below. Here, you get two options to rename the files, so let’s learn how to use both of them one by one.
Rename Using a Template:
3. Then, choose the order of naming the files from the “Automatic Number Order” drop-down menu. You can choose between Ascending, Descending, and more.
Find and replace text:
1. Enter the current common name in the “Existing Text” field. In the bottom pane, you will see the common name get highlighted.
2. In the “Replace With” text box, enter the new common name you want to replace the current name with.
Using GPRename to Rename FilesGPRename is a lightweight batch renaming tool that comes with several different options that can prove useful while renaming files using the Linux GUI. This tool can be helpful for users who find it difficult to batch rename files using their native file manager. Sadly, it doesn’t come pre-installed, but can easily be installed using the following commands:
For Debian-based systems –
For Fedora-bassed systems –
sudo dnf install gprename
For Arch-based systems –
sudo pacman -S gprename
Rename A Single File with GPRename1. Open GPRename from the Applications menu or type gprename in the Linux Terminal.
2. Use the file system tree on the left to navigate to the desired folder. Then, select the file you want to rename in the right pane.
Rename Multiple Files with GPRename1. As explained above, use the file system tree on the left to navigate to the desired folder. Then, select the files you want to rename and choose the appropriate option from the bottom pane.
Frequently Asked QuestionsWhat does rm command do in Linux?
Easily Rename Files in LinuxHow To Enable Or Disable Remote Assistance In Windows 10?
How to Enable or Disable Remote Assistance in Windows 10?
Well, there are tons of benefits of this built-in feature on your Windows device. You can use this feature to allow others to access your machine for troubleshooting work, you can use it perform telecommuting; it helps computer administrators to configure or install programs for remote systems, and more.
Why you should disable remote assistance in Windows 10?
How to enable remote assistance in Windows 10?You can tweak device settings to instantly enable the remote assistance on your PC. You can head to System Properties to perform the task. To do this, follow below mentioned steps:
On the next window, select Remote Settings.
Select Remote tab.
Check Allow Remote Assistance connections to the computer option.
Here, you can uncheck Allow this computer to be controlled remotely option. It will allow people to see your screen, but not take control of your PC. You can keep this option checked, if you want to allow the person to help you with troubleshooting etc.
Tip: In addition to manually enabling remote assistance on your PC, you can also try best remote access software for quick and effective results. These powerful tools come loaded with tons of useful features to make remote assistance seamless.
How to disable remote assistance in Windows 10?To prevent remote access to your computer, you can try different ways. Let’s discuss different ways you can follow to disable remote assistance in Windows 10.
Try Control Panel
In the first step, you can try the Control Panel to disable remote access to your PC. Let’s discuss how?
Search & select Control Panel from the search box on the taskbar.
Once you are on the Control Panel window, select System and Security.
On the next window, select Allow remote access under System.
On the next window, select Remote tab.
Now uncheck Allow Remote Assistance connections to this computer option.
Do it by searching it in Run dialog box
This option helps you immediately disable the remote access in Windows 10. To do this, follow these steps:
Press Win + R keys to open Run box.
Now you will be on System Properties window. Here, select Remote tab.
Now uncheck Allow Remote Assistance connections to this computer option.
Try Windows Registry EditorWindows Registry is a hierarchical database that stores low-level settings for your Windows OS. It stores settings for operating systems and applications that are designed to use the registry. It is an important part of your Windows device. You can use Windows Registry Editor to tweak settings and disable remote assistance in Windows 10. To do this, follow these steps:
Search and select regedit in the search box on the taskbar.
Press Yes when prompted.
Once you are on the Registry Editor window, navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlRemote Assistance.
Reboot your PC to apply the changes.
Note: If you want to enable remote assistance in Windows 10, you need to follow reverse steps mentioned here in corresponding steps.
Next Read:
How To Remotely Lock Your Windows 10 PC
How To Factory Reset Windows PC?
Quick Reaction:About the author
Dinesh Lakhwani
Update the detailed information about How To Mount Remote Directories In Linux With Sshfs on the Cattuongwedding.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!