Finding Files in Linux

Hi Guys,

 

I saw an interesting beginners video on Hak5 about locating files within linux. This made me think about some of the commands that I used to locate certain thing such as files used in apache compromises or files tha developers may have put on a server and forgot where. There are many ways to find what you are looking for but we need to start at the beginning. The following are from a video that Shannon Morse did on finding files.

 

I know the following seem to be the easiest and basic but we have to start somewhere in order to find what we are looking for. Thanks Shannon Morse for the following.

 

—===—===—===—

Locate 3 non case sensative words named test

locate -i -n 3 test

—===—===—===—

Locate case sensative words

locate test
locate Test

—===—===—===—
Search a file called Test for keywords such as word

grep word Test

—===—===—===—
Search for the keyword word in all files using *

grep word *

—===—===—===—
Locate a file that is case sensative and name specific in the current folder. If the files test or Test do not exist, nothing will be shown.

find -name test
find -name Test

—===—===—===—
Locate any file with the name test within it in the current folder.

find -name “*test*”

—===—===—===—
Locate files owned by a user (kf4bzt) in the current folder.

find -user kf4bzt

—===—===—===—
Locate files not owned by a particular user in the current folder.

find ! -user kf4bzt

—===—===—===—
Locate files with a specific group in the current folder.

find -group apache

—===—===—===—
Locate files not with a specific group in the current folder

find ! -group apache

 

—===—===—===—

—===—===—===—

Not that we have some basics behind us, we need to expand on them and do some other searching. πŸ™‚

 

In order to find specific folders by name and place the results into a file:

find . -type d -name ‘uploads’ > uploads

 

—===—===—===—

 

Read the same file above as a reference for another find to locate php extensions within the folders found.Β 

for i in `cat uploads`; do find $i -type f -name ‘*.php’; doneΒ 

 

—===—===—===—

Let’s say that you want to locate files name page68.php and add the results to a file called comp. Below shows how to do this.

find . -type f -name ‘*’ -exec grep –i page68.php {} > comp \;Β 

 

 

Bootable USB Drive and Linux Distro Issues

Hey All,

 

I wanted to throw this out there as this has become an issue with some Linux Operating Systems and there is a possible fix now that I ran across. Let me give you an example of what has taken place lately. There are some Ubuntu or Mint based distros which have a hard time booting from USB thumb drives. I noticed it in Ultimate Edition (Ubuntu), Parrot OS (Debian) and a few others. I used to never have issues with booting into live media or installing operating systems until UEFI was introduced on hardware. This became a royal pain in the rear end to manage. Laptop manufacturers have been locking down the bios so that consumers could not make changes to their own hardware such as disabling UEFI. When Windows 8.1 and 10 came around, a lot of hardware manufactures went with the UEFI way of doing things because Microsoft does not want anyone installing what they want on their own hardware.Β There is always a way to fix a problem but it does take some research.

Once you have gained access to your bios and disabled UEFI support, now you can install what ever you want with little or no issues. Now back to the distro boot and install issues. I found that if you have isohybrid installed on your machine then you can fix a boot issue that keep occurring. Essentially, there is some post processing that in not occurring while creating the first iso burn. People seem to think that this needs to be fixed on the developers side.

 

http://www.syslinux.org/wiki/index.php?title=Isohybrid

https://help.ubuntu.com/community/mkusb/isohybrid

 

—===—===—===—

 

From the link above, here are the instruction needed to make this work. I have been successful in burning and running live media but still may have issues with installed distros though.

I have verified that isohybrid is installed with arch distros such as Manjaro and MateRevenge but may need to be install in Ubuntu based distros from the following instructions.

 

Installing isohybrid

If the program isohybrid is not found, you can install it with the following program packages

  • in 14.04 ‘Trusty’ the package containing isohybrid is syslinux

  • in 15.04 ‘Vivid’ and newer versions, isohybrid is in the package syslinux-utils

sudo apt-get install syslinux
# or
sudo apt-get install syslinux-utils

Using isohybrid

Example:

# run this command only to keep original iso file
cp -p filename.iso filename-hybrid.iso

# the actual command
isohybrid filename-hybrid.iso

See the manual file for more details,

man isohybrid

 

—===—===—===—

 

So this may not be the perfect solution but I have found that it works with distros that you burn to a USB thumb drive and just wont run or install. I am still seeing an issue with the latest Ultimate Edition though which it sounds like they are aware of something happening. I was able to use the instructions above and burn the media and run the distro in live mode but after install, it looks like it freezes or something before completing the boot process.

 

—===—===—===—

 

Update on this process

 

While trying this process out, I found that it does indeed allow for booting into a distro via a USB thumb drive. It still does not fix the issue of doing an OS install to a physical hard drive. I have tried Ultimate Edition where the install looked like it went through but upon reboot would not do anything. I tried Parrot OS and the install fails while writing to the disk. There are some distros that I can install such as arch releases and SharkLinux. I am sure that most Ubuntu distros should install without issue.

Linux Backups (Are They Needed??) – Part 2 – BackInTime

Now that we have a good snapshot backup application installed we need to make sure that our personal files such as documents, pictures, video, etc are backed up as well. Since TimeShift takes care of the operating system side an application called backintime will take care of the rest. This has very similar capabilities as TimeShift such as full and incremental backups but with TimeShift, from what I can tell, the backups stay on the local machine where with backintime you can tell the app where to place the backups. Backintime also uses the rsync command directly in doing its backups and restores.

 

—===—===—===—

 

The installation process is identical to the the way we install most packages. Below are the steps that can be used to install the backintime backup / restore application.

 

Now for the BackInTimeΒ installation from Pamac (Add / Remove Software Application):

  • Open the Pamac application (Add / Remove Software Application)
  • Type in backintime in the search
  • Click on the AUR tab
  • Select backintime
  • Click Apply
  • A popup will show that there will be dependencies that need to be resolved. Click on the Commit button
  • Enter the sudo password to elevate permission for the installer
  • Just sit back and let the installer finish.
  • Once the install is complete just close the Pamac application
  • Now you have a working version of backintime installed and ready to go.

If you choose to do this from a terminal, here you go:

  • Make sure that yaourt is installed by issue sudo pacman -S yaourt
  • Yaourt is the command line app to work with the AUR repository
  • Remember that yaourt complains about running in root. Run from your local account with sudo access.
  • Open a terminal and type sudo yaourt -S backintime
  • You will need to give your sudo password to elevate for the installation
  • If prompted to edit files, just say no unless you know what you’re doing
  • If prompted to install packages, just say yes
  • Once the installation is complete, you will have a fully operational version of backintime

 

Keep in mind that you can create and run the backups and restore either from the command line as shown below or from the desktop using the backintime application.

 

—===—===—===—

 

[kf4bzt@tim-pc ~]$ backintime –help
usage: backintime [-h] [–config PATH] [–debug]
[–profile NAME | –profile-id ID] [–quiet] [–version]
[–license]

Back In Time – a simple backup tool for Linux.

optional arguments:
-h, –help show this help message and exit
–config PATH Read config from PATH.
–debug Increase verbosity.
–profile NAME Select profile by NAME.
–profile-id ID Select profile by ID.
–quiet Be quiet. Suppress messages on stdout.
–version, -v show backintime’s version number.
–license show backintime’s license.

Commands:
{backup,backup-job,benchmark-cipher,check-config,decode,last-snapshot,last-snapshot-path,pw-cache,remove,remove-and-do-not-ask-again,restore,snapshots-list,snapshots-list-path,snapshots-path,unmount}

backup – Take a new snapshot. Ignore if the profile is not
scheduled or if the machine runs on battery.
backup-job – Take a new snapshot in background only if the profile
is scheduled and the machine is not on battery. This
is use by cron jobs.
benchmark-cipher – Show a benchmark of all ciphers for ssh transfer.
check-config – Check the profiles configuration and install crontab
entries.
decode – Decode pathes with ‘encfsctl decode’
last-snapshot – Show the ID of the last snapshot.
last-snapshot-path – Show the path of the last snapshot.
pw-cache – Control Password Cache for non-interactive cronjobs.
remove – Remove a snapshot.
remove-and-do-not-ask-again – Remove snapshots and don’t ask for confirmation
before. Be careful!
restore – Restore files.
snapshots-list – Show a list of snapshots IDs.
snapshots-list-path – Show the path’s to snapshots.
snapshots-path – Show the path where snapshots are stored.
unmount – Unmount the profile.

For backwards compatibility commands can also be used with trailing ‘–‘. All
listed arguments will work with all commands. Some commands have extra
arguments. Run ‘backintime <COMMAND> -h’ to see the extra arguments.

 

—===—===—===—

Instead of posting all of the possible settings for the configuration file, I have attached a file with them in it.

 

backintime_config_settings

 

 

—===—===—===—

 

If moving a configuration from one machine to another. Make sure that you change the hostname and make sure that the backup folder has been created. Once that is done, run the following to check the config file.

 

[kf4bzt@tim-pc ~]$ backintime check-config

Back In Time
Version: 1.1.14

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime –license’ for details.
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Check/prepair snapshot path β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Check/prepair snapshot path: done

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Check config β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Check config: done

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Install crontab β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
ERROR: Failed to get crontab lines: 1, no crontab for kf4bzt

Install crontab: done

Config /home/kf4bzt/.config/backintime/config profile ‘Main profile’ is fine.

 

—===—===—===—

 

Now that the configuration is setup and ready, go ahead and try the first backup run.

 

[kf4bzt@tim-pc ~]$ backintime backup

Back In Time
Version: 1.1.14

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime –license’ for details.

INFO: Lock
WARNING: Inhibit Suspend failed.
INFO: Take a new snapshot. Profile: 1 Main profile
INFO: Call rsync to take the snapshot
INFO: Save config file
INFO: Save permissions
INFO: Create info file
INFO: Remove backups older than: 20170220-000000
INFO: Keep min free disk space: 10240 MiB
INFO: Keep min 2% free inodes
INFO: Unlock

 

—===—===—===—

 

As you can see, the backup was successful and created the folder with the content, if any.

 

[kf4bzt@tim-pc ~]$ ls -alh ./Backups/backintime/tim-pc/kf4bzt/1/
total 12K
drwxr-xr-x 3 kf4bzt kf4bzt 4.0K Mar 22 15:19 .
drwxr-xr-x 3 kf4bzt kf4bzt 4.0K Mar 22 15:18 ..
dr-xr-xr-x 3 kf4bzt kf4bzt 4.0K Mar 22 15:19 20170322-151819-785
lrwxrwxrwx 1 kf4bzt kf4bzt 19 Mar 22 15:19 last_snapshot -> 20170322-151819-785

 

—===—===—===—

—===—===—===—

 

As I set Back In Time for Ubuntu Mate, I took some screenshots to show what this would look like. Back In Time can either be used as a standalone backup solution or as a supplement to the TimeShift backup agent for pulling use home folders and other things that may not be pulled from the original snapshot. As shown in the first screenshot, the Back In Time application can be used as a full system backup solution. When you click on yes, the settings get changed to make the app capable of doing a full system backup.

 

 

As we look into the settings, most can be left as default but there are some that do need to be modified in order for you to have the backups that you need when you need them. First first item to change will be where you want your snapshots to be located. Just create folder and point to it with Back In Time. You will also need to set a schedule for backup snapshots to be taken. I set mine as everyday at midnight local.

 

 

The Include tab allows you to choose either files or folders or even both if you like to be included in the regular snapshot. I chose most of the folders within my home directory as TimeShift does not include /home in its snapshots.

 

 

The excludes tab allows you to skip certain files or folders but I have left this at its default setting as I think what is had will work for now. This will be good for excluding certain data from a full snapshot that you do not need to be backed up.

 

 

The next tab called auto-remove, allows you to set how often you want snapshots to be removed within a certain time limit, drive space limit, as well as getting down to how many inodes left before removing snapshots. I just left this at the default settings for now. I may tweak it more a little later.

 

 

The items under the option tab was left at their defaults as well. Most of this is self explanatory for the most part.

 

 

And finally, the expert options tab, I just left this one as is as well.

 

 

Now that we have our settings the right way, Back In Time will take you to the main screen where you can kick off your first snapshot. In the upper left corner is an icon that looks like a harddrive with an arrow pointing down. Hit that button to start a manual backup of the files and folders shown in the middle of the screen.

 

 

After you hit the button, you will see data moving at the bottom of the screen. This just shows what is being backed up and what percentage is complete from each item.

 

 

If you are wondering what is being backed up and if the files and or folders are include a change or just informational, you can see the logs by going to the top of the screen, clicking on View and selecting view last log. This will show you everything that was backed up the last time and what its status was.

 

Linux Backups (Are They Needed??) – Part 1 – TimeShift

Hey Guys,

To answer the question above, YES. Backups are needed when dealing with any computer operating system. There are many backup solutions out there that conduct backups in different ways. Some do full and incremental backups, some do bare metal type backups while some issue full and incremental system snapshots. Well, in this small post, I want to go over an app that I found for Manjaro and any other linux distro called TimeShift.

http://www.teejeetech.in/p/timeshift.html

https://launchpad.net/timeshift

TimeShift is very similar to the MacOS Timemachine and the Windows built in backup and restore app for snapshots. This app has turned out to be an awesome package and a necessity for my linux system at home. Below is a description of the application from the development page on what this app is. I like the fact that it uses rsync as part of its operations. This makes for a good way to make sure that backups stay up to date and if something happens during the backup or restore process, the rsync side should be able to pick up where it left off.

“TimeShift is a system restore utility which takes incremental snapshots of the system using rsync and hard-links. These snapshots can be restored at a later date to undo all changes that were made to the system after the snapshot was taken. Snapshots can be taken manually or at regular intervals using scheduled jobs.”

Here is another statement that I thought would be appropriate here as well.

“TimeShift is similar to applications like rsnapshot, BackInTime and TimeVault but with different goals. It is designed to protect only system files and settings. User files such as documents, pictures and music are excluded. This ensures that your files remains unchanged when you restore your system to an earlier date. If you need a tool to backup your documents and files please take a look at the excellent BackInTime application which is more configurable and provides options for saving user files.”

To install TimeShift within Manjaro, you can do it one of two ways. Just in case, make sure that you have AUR initiated in the Pamac application:

  • To initialize AUR, open the Pamac application (Add / Remove Software Application)
  • Click on the button in the upper right that looks like three lines on top of each other.
  • Click preferences
  • Give the sudo password if asked
  • Click on the AUR tab
  • Click on Enable AUR Support
  • Select both Search in AUR by default and Check for Updates in AUR
  • Close the window

Now for the TimeShift install Process from Pamac (Add / Remove Software Application):

  • Open the Pamac application (Add / Remove Software Application)
  • Type in timeshift in the search
  • Click on the AUR tab
  • Select timeshift
  • Click Apply
  • A popup will show that there will be dependencies that need to be resolved. Click on the Commit button
  • Enter the sudo password to elevate permission for the installer
  • Just sit back and let the installer finish.
  • Once the install is complete just close the Pamac application
  • Now you have a working version of TimeShift installed and ready to go.

If you choose to do this from a terminal, here you go:

  • Make sure that yaourt is installed by issue sudo pacman -S yaourt
  • Yaourt is the command line app to work with the AUR repository
  • Remember that yaourt complains about running in root. Run from your local account with sudo access.
  • Open a terminal and type sudo yaourt -S timeshift
  • You will need to give your sudo password to elevate for the installation
  • If prompted to edit files, just say no unless you know what you’re doing
  • If prompted to install packages, just say yes
  • Once the installation is complete, you will have a fully operational version of TimeShift

Now that you have a working version of TimeShift installed and ready, go ahead and run the applications. There is an initial configuration process that you can set for your usage. Once that is done, click the create button. This will kick off an initial snapshot process and depending on the size of the hard drive, this process can take a little time. Once the initial process is complete, you can create incremental snapshots to be used as restore points within your system.

Here shows the help page for the timeshift command line application. The application is easy to use as you can probably tell.

 

[kf4bzt@tim-pc ~]$ timeshift –help

Timeshift v17.2 by Tony George (teejeetech@gmail.com)

Syntax:

timeshift –check
timeshift –create [OPTIONS]
timeshift –restore [OPTIONS]
timeshift –delete-[all] [OPTIONS]
timeshift –list-{snapshots|devices} [OPTIONS]

Options:

List:
–list[-snapshots] List snapshots
–list-devices List devices

Backup:
–check Create snapshot if scheduled
–create Create snapshot (even if not scheduled)
–comments <string> Set snapshot description
–tags {O,B,H,D,W,M} Add tags to snapshot (default: O)

Restore:
–restore Restore snapshot
–clone Clone current system
–snapshot <name> Specify snapshot to restore
–target[-device] <device> Specify target device
–grub[-device] <device> Specify device for installing GRUB2 bootloader
–skip-grub Skip GRUB2 reinstall

Delete:
–delete Delete snapshot
–delete-all Delete all snapshots

Global:
–snapshot-device <device> Specify backup device (default: config)
–yes Answer YES to all confirmation prompts
–btrfs Switch to BTRFS mode (default: config)
–rsync Switch to RSYNC mode (default: config)
–debug Show additional debug messages
–verbose Show rsync output (default)
–quiet Hide rsync output
–help Show all options

Examples:

timeshift –list
timeshift –list –snapshot-device /dev/sda1
timeshift –create –comments “after update” –tags D
timeshift –restore
timeshift –restore –snapshot ‘2014-10-12_16-29-08’ –target /dev/sda1
timeshift –delete –snapshot ‘2014-10-12_16-29-08’
timeshift –delete-all

Notes:

1) –create will always create a new snapshot
2) –check will create a snapshot only if a scheduled snapshot is due
3) Use –restore without other options to select options interactively
4) UUID can be specified instead of device name
5) Default values will be loaded from app config if options are not specified

 

—===—===—===—

 

To create a backup from the command line:

  • Type sudo timeshift –create
  • As this is a first time run, it will say “First run mode (config file not found)”
  • This will create the initial full snapshot of the operating system
  • Below is an example of the full system snapshot run

 

—===—===—===—

 

[kf4bzt@tim-pc ~]$ sudo timeshift –create
First run mode (config file not found)
Selected default snapshot type: RSYNC
Selected default snapshot device: /dev/sda1
——————————————————————————
Estimating system size…
Creating new snapshot…(RSYNC)
Saving to device: /dev/sda1, mounted at path: /
Synching files with rsync…

Created control file: /timeshift/snapshots/2017-03-22_11-03-47/info.json
Parsing log file…

RSYNC Snapshot saved successfully (845s)
Tagged snapshot ‘2017-03-22_11-03-47’: ondemand
——————————————————————————
Added cron task: /etc/cron.d/timeshift-hourly
Added cron task: /etc/cron.d/timeshift-boot

 

—===—===—===—

 

I issued the following to list the snapshots on the machine so far

 

[kf4bzt@tim-pc ~]$ sudo timeshift –list
[sudo] password for kf4bzt:
Device : /dev/sda1
UUID : 138fcf48-a8ea-49cd-aa1a-57f2a6a981c7
Path : /
Mode : RSYNC
Device is OK
1 snapshots, 129.5 GB free

Num Name Tags Description
——————————————————————————
0 > 2017-03-22_11-03-47 O

 

—===—===—===—

 

For the sake of testing I reran the create to kick off an incremental snapshot

 

[kf4bzt@tim-pc ~]$ sudo timeshift –create
——————————————————————————
Creating new snapshot…(RSYNC)
Saving to device: /dev/sda1, mounted at path: /
Linking from snapshot: 2017-03-22_11-03-47
Synching files with rsync…
Created control file: /timeshift/snapshots/2017-03-22_11-19-36/info.json
Parsing log file…
RSYNC Snapshot saved successfully (13s)
Tagged snapshot ‘2017-03-22_11-19-36’: ondemand
——————————————————————————

 

—===—===—===—

 

Here is another list with the initial and incremental snapshots in place

 

[kf4bzt@tim-pc ~]$ sudo timeshift –list
Device : /dev/sda1
UUID : 138fcf48-a8ea-49cd-aa1a-57f2a6a981c7
Path : /
Mode : RSYNC
Device is OK
2 snapshots, 129.4 GB free

Num Name Tags Description
——————————————————————————
0 > 2017-03-22_11-03-47 O
1 > 2017-03-22_11-19-36 O

 

—===—===—===—

 

To do a restore of the snapshot just issue the following

 

[kf4bzt@tim-pc ~]$ sudo timeshift –restore –snapshot ‘2017-03-22_11-19-36’
******************************************************************************
To restore with default options, press the ENTER key for all prompts!
******************************************************************************

Press ENTER to continue…

Re-install GRUB2 bootloader? (recommended) (y/n): y

Select GRUB device:

Num Device Description
——————————————————————————
0 > sda ATA ST3160023AS [MBR]
1 > sda1 ext4, 150.6 GB GB
2 > sdb ATA SAMSUNG HD321HJ [MBR]
3 > sdc ATA ST3160023AS [MBR]

[ENTER = Default (/dev/sda), a = Abort]

Enter device name or number (a=Abort): 0

******************************************************************************
GRUB Device: /dev/sda
******************************************************************************

======================================================================
WARNING
======================================================================
Data will be modified on following devices:

Device Mount
——— —–
/dev/sda1 /
Please save your work and close all applications.
System will reboot after files are restored.

======================================================================
DISCLAIMER
======================================================================
This software comes without absolutely NO warranty and the author takes no responsibility for any damage arising from the use of this program. If these terms are not acceptable to you, please do not proceed beyond this point!

Continue with restore? (y/n): y
Mounted ‘/dev/sda1’ at ‘/mnt/timeshift/restore/’
******************************************************************************
Backup Device: /dev/sda1
******************************************************************************
******************************************************************************
Snapshot: 2017-03-22_11-19-36 ~
******************************************************************************
Restoring snapshot…
Synching files with rsync…

Please do not interrupt the restore process!
System will reboot after files are restored

building file list … done
.d..t…… mnt/
.d..t…… timeshift/
>f..t…… var/log/journal/f035dd48f4eb41d0ba36ad8c9879b1bd/system.journal
.d..t…… var/log/timeshift/

sent 24,747,157 bytes received 49 bytes 16,498,137.33 bytes/sec
total size is 7,407,772,695 speedup is 299.34

Re-installing GRUB2 bootloader…
Installing for i386-pc platform.

Installation finished. No error reported.

Updating GRUB menu…
Generating grub configuration file …
Found background: /usr/share/grub/background.png
Found Intel Microcode image
Found linux image: /boot/vmlinuz-4.4-x86_64
Found initrd image: /boot/initramfs-4.4-x86_64.img
Found initrd fallback image: /boot/initramfs-4.4-x86_64-fallback.img
Found Windows 7 (loader) on /dev/sdb1
Found memtest86+ image: /boot/memtest86+/memtest.bin
done

Synching file systems…
Rebooting system…
Failed to read reboot parameter file: No such file or directory
Rebooting.

 

—===—===—===—

—===—===—===—

 

While installing within Ubuntu Mate 17, I created the following screenshots to show what TimeShift should look like from the beginning. The first screenshot starts the configuration of Timeshift. I have been leaving this as RSYNC as I find it works better when creating backups for your data.

 

 

You need to choose a drive to place the snapshots onto for storage. As you can see, my laptop only has the one drive so I selected sda1 to store the snapshots.

 

 

Now, we have to choose how we want the snapshots to be complete. The default is Boot at 5 and Daily at 5. I added Weekly at 3 just to play around with the settings. Keep in mind that your machine has to be powered on for this work or not in sleep mode.

 

 

The next screenshot is for creating Includes and Excludes but if you want a full system snapshot them leave this at default. Keep in mind that the snapshots change only if there are changes to the file system. This does not include the items within the users home folders. You will need an app such as Back In Time to backup the home folders and content.

 

 

The screenshot shown below show a snapshot in place.

 

 

And the final screenshot shows the information about the snapshot.

 

SSH Keys

One thing that I want to post on is how unsecure our communication can be. Yes, SSH tends to be somewhat secure but it needs help. FTP is horribly unsecure which is why SFTP is the preferred method for file transfer. FTP is open communications while SFTP uses the SSH protocol to send files from one location to another. In order to make sure that your connections are secure while either working on a Linux servers or workstation or file sharing, etc., you need to make sure that your connection is secure. This can be done a number of ways but the preferred method is to use RSA keys which are easy to create.

So, what are RSA keys you ask? Great question..Let’s see what the experts at Name Cheap have to say on this subject.

“An RSA key is a private key based on RSA algorithm. The private Key is used for authentication and a symmetric key exchange during establishment of an SSL/TLS session. It is a part of the public key infrastructure that is generally used in case of SSL certificates.” Beasically RSA keys use a public and private key pair to authenticate a set of communications between two devices. The private key should never be shared with anyone and the public key needs to be added to what is called an authorized_key file on each device.

You can login to a remote Linux server without entering a password in 3 simple steps using ssh-keygen and ssh-copy-id shown below. The ssh-keygen command creates the public and private keys where the ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys. You can also manually copy the public keys from device to another if you are more comfortable with that method.

Below, I will show how to use ssh-keygen command as well as the ssh-copy-id.

First things needed in a secure communications path is to generate a public and private key pair using the ssh-keygen command string on the local device. And don’t worry, for this demo, I will generate a new pair and I have already regenerated them.

Make sure that you are logged into the the server you need to create the keys on
Enter the following to create an RSA key pair. You can either use the –t switch with rsa or just type ssh-keygen by itself.

ssh-keygen –t rsa

In the following example, I have generated a new rsa key

[kf4bzt@tim-pc ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/kf4bzt/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/kf4bzt/.ssh/id_rsa.
Your public key has been saved in /home/kf4bzt/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:EVm/DIwjQJngLKZmkdm6p3SO5aPge300pNBcV7+QkV4 kf4bzt@tim-pc
The key’s randomart image is:
+—[RSA 2048]—-+
| .ooo .ooo. |
| o+ o. ..= o+E |
|.=o.o o = +oo. |
|o.o. o o o +… |
|.+ . o S o. |
|o . . o |
|.o +. . . |
|+ Oo . . |
| *+o. . |
+—-[SHA256]—–+

Now that we have the RSA key pair generated and ready to use, let’s make sure that the public key is on the remote device.

—===—===—===—

[kf4bzt@tim-pc ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p 2223 192.168.1.87

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/home/kf4bzt/.ssh/id_rsa.pub”
The authenticity of host ‘[192.168.1.87]:2223 ([192.168.1.87]:2223)’ can’t be established.
ECDSA key fingerprint is SHA256:8n59vxFvO+/FPqqcsEEc3oRrXDvzvftjSmRQJaTTD3Q.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
kf4bzt@192.168.1.87’s password:

Number of key(s) added: 1

Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

—===—===—===—

Now try logging into the machine, with: “ssh -p ‘2223’ ‘192.168.1.87’”
and check to make sure that only the key(s) you wanted were added.

[kf4bzt@tim-pc ~]$ ssh -p 2223 192.168.1.87

Welcome to Ubuntu Zesty Zapus (development branch) (GNU/Linux 4.10.0-11-generic i686)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

Ubuntu 12.04 LTS end-of-life is April 25, 2017 — Upgrade your Precise systems!
$ sudo do-release-upgrade -m server

0 packages can be updated.
0 updates are security updates.

Last login: Fri Mar 17 13:29:22 2017 from 209.33.142.3

—===—===—===—

Keep in mind the first time you log into the device using RSA keys, you will be prompted for your user password. This is because the SSH connection is pulling the fingerprint to make sure that it and the key pair match. After that, you should have gotten logged in via SSH with no password prompt. If you are still getting password prompts, check the permissions of the authorized_keys file to make sure that they are set to 0600 and nothing else. This file needs to be locked down.