Author: mark_user

  • Synchronize the Time & Date in Ubuntu

    Synchronize the Time & Date in Ubuntu

    Understanding Time

    Time is a critical component of every computer. When to run updates, launch scheduled tasks, or just to keep user’s informed, are all dependent on time.

    Every computer has a built in clock on the motherboard, usually powered by a battery, to keep track of the time. This hardware based clock is called the Real Time Clock (RTC) and is used to power the human readable ‘system time’, based on time zones.

    • System Time = Uses Time Zones
    • RTC = Real Time Zone = Uses Hardware clock

    Unfortunately, the hardware clock will always eventually get out of sync with real time and need to be adjusted. This occurs because of power outages, battery on the MB dies, or other reasons.

    Ubuntu Settings

    Two commands are used to control the date and time. First, the ‘timedatectl‘ command is used to set the time zone. Next, the ‘timesyncd‘ command is used start or stop the sync service and to turn on or off the network time protocol (NTP).

    An older process to manage these functions is called ntpd. While this process is still supported, it is recommended to use the newer methods.

    Check Your Time Zone

    In the United States, there are three primary time zones.

    • UTC (Universal Time Coordinated)
    • EDT (Eastern Daylight Time) = 2nd Sunday March to 1st Sunday in Nov. = 4 hr behind UTC
    • EST (Eastern Standard Time) = 1st Sunday Nov to 2nd Sunday March. = 5 hr behind UTC

    Get a list of available time zones

    Change the Time Zone

    Check the Sync & NTP Services

    Note: Typically, the Real Time Clock or ‘RTC in local TZ’ should always be set to ‘no’. This is due to that most of the US uses spring/fall time changes and the RTC does not know anything about that.

    Turn on the ‘System clock synchronized’

    Check that there is a name server or two listed in the configuration file. The entries should be space separated.

    Add the following lines under [Time]:
    NTP=ntp.myserver.com time.nist.gov

    Next, run the below command.

    Turn on the ‘NTP Service’

    Verify the Clock is Synced

    Ref: https://www.linuxfordevices.com/tutorials/ubuntu/set-up-time-synchronization-ubuntu

    Ref: https://opensource.com/article/20/6/time-date-systemd

    Ref: https://ubuntu.com/server/docs/about-time-synchronisation

  • Analyze Network Traffic using TCPDump

    Analyze Network Traffic using TCPDump

    The Basic

    TcpDump is a command line network monitoring tool for viewing packets, in real time, as they pass through the server network interface. Specifically, it can be used to view and record packets going into and out of a network interface and can be used to conduct all sort of analysis.

    I use this tool to see if logs are actually coming into a server, typically over syslog, and what port are they being received on or are going to.

    Inbound traffic from IP 10.16.28.143

    -i = listen on network card ens160
    -n = do not translate IP address to DNS names
    -nn = do not translate IP to DNS names or ports to service names
    -v = verbose

    Inbound traffic to a specific port

    Either inbound or outbound traffic to/from port 12011

    Outbound traffic to IP 10.16.1.121

    Outbound traffic on port 443

    Only capture TCP outbound traffic going to IP 10.10.192.30 on port 443.

    See if you are getting syslog data

    Only capture data coming from subnets 10.10.149.0/24 or 10.10.153.0/24 and arriving on port 514.

    Outbound traffic going to port 443

  • Customize Your VIM Settings

    Customize Your VIM Settings

    Introduction

    VIM is a popular Linux text editor program. Users can customize VIM by creating a .vimrc file in their home directory. Then, when launching VIM, it will load any variables that were preset in this file. You’ll need to set the file permissions of the .vimrc file to rw-rw—-.

    A sample .vimrc file

    In my opinion, the two most useful commands are to set line numbers on the file and set the color scheme, to make files easier to read. Here is how you set them up in the .vimrc file.

    Get a list of available color schemes

    VIM comes with several color schemes loaded by default. You can also download others. To check what defaults are available, use this command.

    References

    https://phoenixnap.com/kb/vim-color-schemes

    https://thelinuxcode.com/vimrc_tutorial

  • File, Processes, & System Details in Ubuntu

    File, Processes, & System Details in Ubuntu

    Introduction

    When working with systems, for troubleshooting, performance tuning, or regular maintenance, it’s often essential to gather key system information. This includes details such as the operating system version, hardware specifications, running processes, or file system disk usage. You might need to monitor CPU usage in real time or check how much storage space is available on your drives.

    Fortunately, there are a set of powerful command-line tools that make this process quick and efficient. Below, we’ll explore some of the most useful commands to help you monitor and manage your system effectively.

    What is OS Linux version

    Get the installed memory (RAM)

    Get a CPU count

    Get the hard drive details

    Get disk space usage by directory

    disk space used by the specified files and for each subdirectory.

    Monitor Processes using TOP

    Just run the command ‘top’ or ‘htop’ , if it is installed, to get real time Mem and CPU usage and see what process are resource hogs.

  • Change Windows Cmd Line Startup Folder

    Change Windows Cmd Line Startup Folder

    Change Default Startup Path for Command Prompt

    Right click on the command prompt then select properties. On shortcut tab, change “Start in:”

  • Start Encrypting Your Files in Windows

    Start Encrypting Your Files in Windows

    Getting Started

    File encryption adds a level of security to your critical files. In Windows, you can create an encrypted folder and it will auto encrypt any files you drop into the folder.

    Windows uses the Encrypted File System (EFS) platform. The first time you encrypt a file, it will auto generates a key set and a certificate. Windows manages the encryption for you on the backend. In other words, once you set it all up, it will automatically decrypt a file when you open it, and encrypt it when you close the file.

    After you set up a folder in windows and encrypt it, any files you drop into that folder will automatically be encrypted too. No need to set the encryption on each file.

    Check to see if your files are already encrypted.

    Does the folder or file has a lock on it?

    An alternate method, is to go to the file, right click, select details, check the attributes for the E flag. (Note: The A flag means the archive bit is set).

    Finally, you can open a command prompt and run cipher.

    Here are two folders, one has encrypted files inside it and one does not.

    Encrypt a folder or files

    The easiest way to encrypt multiple files is to create an encrypted folder and drop files into it. Make a new folder on the desktop, right click on folder, select properties, go to general tab, select advanced button, and check the encrypt box.

    After you see the lock icon on the folder, this means the folder is encrypted. Any files you drop into it, will automatically be encrypted too and will display the lock icon. If you drag the the file outside the folder, it will remain encrypted.

    Note: the lock symbol does not always show up right away after you encrypt a file/folder, don’t panic.