How to do it...

  1. We are going to use the mount command to mount the file system. Then, we are going to use the ro and noexec options to mount:
$ mount -t ext4 /directorytobemounted /directoryinwhichitismounted -o ro,noexec
  1. We can mount the device with default options too. Run the following command to mount a device using the default options:
$ mount -t ext4 /directorytobemounted /directoryinwhichitismounted -o defaults
  1. The scp command is used to securely transfer files between two hosts. We can transfer files from our localhost to a remote host, and also between two remote hosts. Run the following command to transfer files from a remote host to our local host:
$ scp from_host_name:filename /local_directory_name

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.