Paul Sutton

Cybersecurity

CyberSecurity part 14

Starting and stopping services is now down to SystemD. I am including the video below as it should offer a basic introduction to this.

I am fully aware that there is a huge argument between fans of SystemD and fans of system V (used previously). I am NOT prepared to get in to arguments over this. I may however make another post that covers system V.

If you want to experiment with this, you will more than likely need access to your own GNU/Linux install, perhaps on a Raspberry Pi.

Links

Tags

#CyberSecurity,#systemD.#Basics

CyberSecurity part 13

So we are on part 13, well done and thank you to everyone who has stuck with this so far.

So today, I am going to link to three videos, which give more details on specific bash commands. Hopefully this will speed things up a little, there are probably better videos, so please feel free to search, watch and share alternative videos.

Links

Tags

#CyberSecurity,#Shell,#Grep,#Sed,#Cron

CyberSecurity part 12

So we are on part 12, well done and thank you to everyone who has stuck with this so far. Today I am linking to s shell scripting crass course.

Joe Collins who presented the bash videos earlier also has a series of videos on shell scripting

Useful stuff

If you write a bash script, that needs the user to run as with elevated privileges this code may be handy.

if [ "$EUID" -ne 0 ]
  then echo "Please run as root / sudo"
exit

  else

Links

Tags

#CyberSecurity,#Shell,#Scripting

CyberSecurity part 11

Moving on, the last video in that series covered shell scripting, It touched on the nano text editor, this is usually the default installed editor. I thought before we move on further, it would be a good idea to make sure people are at least familiar with some of the features of nano.

Again providing the login login link for quick and easy access.

nano

Discuss

Tags

#CyberSecurity,#Nano,#Editor

CyberSecurity part 10-1

So far, this series as presented links to a good series on the BASH shell, so you should now be able to navigate and carry out basic and may be more advanced tasks. The series of posts, will now move on to other topics. I am aware that much of this may be new to people.

As I mostly hangout on IRC (Internet Relay Chat), which is a text based real time chat system, I am happy to provide basic support via IRC, probably early evenings (UTC). So between 19:00 and 21:00. I am on irc as zleap.

I have included a direct link below to the web based chat area [2], so using channel #phillw. I know the owner due to being involved with testing big blue button.

You are encouraged to read up a little on IRC [3], For transparency, we are using the Libera Chat network [4]. The web client is hosted with KiwiChat [5].

Discuss

1 Tuxiversity Forum

Further help with this series of posts

2 IRC Chat 3 What is irc 4 Libera Chat 5 Kiwi Chat

Tags

#CyberSecurity,#BASHShell

CyberSecurity part 10

So on to video 8 of 8, I will maintain the login link so that you don't need to go hunting back through previous posts.

console1

This video completes this 8 part series, the next video that I found covers using the nano editor. After which I have found some more videos that cover shell scripting in more detail. I think it is important to be familiar with an editor before moving. So you may want to skip ahead to tomorrows video watch that, then come back to this if you want to be more familiar with nano going forward.

Discuss

Summary

I am not providing a summary for this.

Tags

#CyberSecurity,#BASHShell

CyberSecurity part 9

So on to video 7 of 8, I will maintain the login link so that you don't need to go hunting back through previous posts.

console1

Discuss

Summary

  • free & free -h
  • df & df -h
  • du & du | les
  • watch – real time monitoring
    • watch free -h – ctrl q to quit
  • dmesg – kernel actions, lots of output so...
    • dmesg | tail
  • to view the last entries in syslog
    • tail / var/log/syslog
    • tail / var/log/syslog > syslog.txt – redirect to a file
  • System d
    • journalctrl – displays messages from boot
  • top – display processes etc
  • htop – as above but nicer program with more control
  • killall – kills a process
  • Network
    • video uses ifconfig, which is depreciated so ..
      • ip addr show – will show your ip and network info
  • ping – tests a website or computer is up
    • ping www.youtube.com
    • ping ipaddress e.g ping 192.168.2.100
  • Mounting file systems
  • lsblk – lists block devices
    • sudo mount /dev/sda2 /mnt – mounts a device (note this is the example from the video)
    • sudo umount /dev/sda2 – unmounts a device
  • sudo fdisk -l – display info on devices
  • UUID
    • sudo blkid – lists devices and uuid info
  • uname -a – lists system info e,.g kernel version and architecture
  • history – display command history
    • history | less or
    • history 10
  • pressing tab after a partly typed command auto completes e.g :
    • his produces
    • history
  • cal displays calender
  • Disk defrag, as video says this may not be needed, but IS useful if needed
    • sudo ex4defrag /home -c this checks to see if you need to defrag – degrag s only for older hard disks, does not work on solid state devices
  • sudo reboot – will reboot the system
  • sudo shutdown -r – will reboot
  • sudo shutdown -h halts the system
  • sudo shutdown -t 20 – sets a 20 minute timer
    • sudo shutdown -c cancels the shutdown timer

Again, all these commands do have a related man page.

Tags

#CyberSecurity,#BASHShell

CyberSecurity part 8

So on to video 6 of 8, I will maintain the login link so that you don't need to go hunting back through previous posts.

console1

Discuss

Summary

So the topics looked at here are, and this specific to apt, so most of the commands work on Debian, and one or two such as the PPA management is Ubuntu specific. Again watching the video is really useful

  • apt update
  • sudo apt upgrade
  • sudo apt dist-upgrade
  • sudo apt remove
  • sudo apt install
  • apt cache search – for lots of output you can use
    • apt cache search | less
  • downloading deb packages with wget
  • installing downloaded deb packages with dpkg
  • installing from PPA (personal package archive – ubuntu specific)
  • cleaning the system
    • sudo apt clean
    • sudo apt autoclean
    • sudo apt autoremove
    • sudo apt autoclean

Again the man pages have a lot more information.

Tags

#CyberSecurity,#BASHShell

CyberSecurity part 7

So on to video 5 of 8, I will maintain the login link so that you don't need to go hunting back through previous posts.

console1

Discuss

Summary

Not all of these will work with vfsync.

Add user accounts with adduser To drop to that user from your account su – bob (the hyphen is important display groups for a user su -c 'groups' bob

other commands mentioned include :-

useradd – adds user to a grop gropdel / delgroup – manage groups deluser – delete user

All these are covered in man pages

change user password

sudo passwd bob

lock a user out of their account : sudo passwd -l bob – unlock a user account : sudo passwd -u bob

delete a user

sudo deluser bob will only remove a user, to remove their files use

cd /home ls rmdir -r bob (use recursive with extreme caution)

When you set up a user, you add info, this is called finger information, if you need to change this, then you can use the chfn command with

sudo chfn user

Again this is just a summary and should be used in combination with the video.

Tags

#CyberSecurity,#BASHShell

CyberSecurity part 6

So on to video 4 of 8, I will maintain the login link so that you don't need to go hunting back through previous posts.

console1

Discuss

Summary

Find command allows you to find:-

  • Programs
  • Files

man pages

man is short for manual, we cam use this to view the manual pages for commands e.g :-

  • man mv
  • man nano
  • man htop

On a similar note there are also info pages, which are another source of information.

If we want to find programs we can use the which command which outputs the path to a particular program.

Command : which htop Output : /use/bin/htop

Finding files

find -name junk.txt will find and display the path to the junk.txt file

As a normal user you can also search for files such as fstab, however as this is owned by root you will get permission errors.

Find text within files

grep (GNU Regular Expression Parser)

grep nano junk.txt so here we have command string to search for file to look in

we can direct the output of this with

grep nano junk.txt > grep.txt

will search junk.txt for the string nano, the direct the output to the file grep.txt

Tags

#CyberSecurity,#BASHShell