adi-goldstein-EUsVwEOsblE-unsplash

How to Install and Set Up WireGuard VPN on Linux

WireGuard is a relatively new VPN technology that is becoming increasingly popular for its simplicity, speed, and security. In this tutorial, we’ll guide you through the process of installing and setting up WireGuard VPN on your Linux machine.

Step 1: Check the Kernel Version Before you start

make sure that your Linux kernel is version 3.10 or higher, as WireGuard requires this to run. You can check your kernel version by typing the following command in your terminal:

uname -r

Step 2: Install WireGuard

WireGuard is available in most Linux distributions’ official repositories. To install it, type the following command in your terminal:

For Debian/Ubuntu based systems:

sudo apt-get install wireguard

For CentOS/RHEL based systems:

 yum install wireguard-tools

Step 3: Generate Public and Private Keys

WireGuard uses public-key cryptography to establish a secure connection. You’ll need to generate a pair of public and private keys for your VPN server and client. To generate them, type the following command in your terminal:

umask 077
wg genkey | tee privatekey | wg pubkey > publickey

This will generate a private key and a public key. Make sure to keep the private key safe, as it should only be known to you.

Step 4: Configure the VPN Server

Next, you’ll need to configure the VPN server. This involves creating a configuration file and setting up the network interface. Here’s an example configuration file:

[Interface]
PrivateKey = <server-private-key>
Address = 10.0.0.1/24
ListenPort = 51820

[Peer]
PublicKey = <client-public-key>
AllowedIPs = 10.0.0.2/32

Replace <server-private-key> with the private key you generated in Step 3, and <client-public-key> with the public key of the client you’ll be connecting to. You can add more [Peer] sections to allow more clients to connect.

Save this configuration file as /etc/wireguard/wg0.conf, and then start the WireGuard service by typing:

sudo systemctl start wg-quick@wg0
sudo systemctl enable wg-quick@wg0

Step 5: Configure the VPN Client

To connect to the VPN server, you’ll need to configure the client. This involves creating a configuration file similar to the server’s configuration file. Here’s an example:

makefileCopy code[Interface]
PrivateKey = <client-private-key>
Address = 10.0.0.2/24

[Peer]
PublicKey = <server-public-key>
Endpoint = <server-ip>:51820
AllowedIPs = 0.0.0.0/0

Replace <client-private-key> with the private key you generated in Step 3, <server-public-key> with the public key of the server, and <server-ip> with the IP address of the server.

Save this configuration file as /etc/wireguard/wg0.conf, and then start the WireGuard service by typing:

sudo systemctl start wg-quick@wg0
sudo systemctl enable wg-quick@wg0

That’s it! You should now be able to connect to your WireGuard VPN server. You can check the status of your VPN connection by typing:

sudo wg show

In this tutorial, we’ve covered the basics of installing and setting up WireGuard VPN on Linux. With its simplicity, speed, and security, WireGuard is

Developer working on code late at night, view from the back

Creating and Managing Users and Groups in Linux

As a Linux administrator, one of your most important tasks is to manage users and groups on your system. In this post, we will cover the basics of creating and managing users and groups in Linux.

Creating Users

In Linux, user accounts are stored in the /etc/passwd file. Each line of the file represents a user account, with fields separated by colons. The fields include the user’s name, password, UID, GID, and home directory. The password field is actually a placeholder, as Linux stores passwords in a separate file, /etc/shadow.

To create a new user, you can use the “useradd” command. The basic syntax is:

useradd [options] username

The options can include things like the user’s home directory, UID, and GID. For example, to create a new user named “joe” with a home directory of /home/joe and a UID of 1000, you would use the following command:

useradd -d /home/joe -u 1000 joe

You can also specify the initial password for the user when you create them. For example, to set the password for joe as “password”, you can use the following command:

echo joe:password | chpasswd 

Managing Users

Once you have created a user, you may need to make changes to their account. For example, you may need to change their password or update their home directory.

To change a user’s password, you can use the “passwd” command. For example, to change joe’s password, you would use the following command:

passwd joe

You can also use the “usermod” command to make changes to a user’s account. For example, to change joe’s home directory to /home/joe2, you would use the following command:

usermod -d /home/joe2 joe

Creating and Managing Groups

In Linux, groups are used to control access to files and resources. Each user can be a member of one or more groups, and each group has a unique GID.

To create a new group, you can use the “groupadd” command. The basic syntax is:

groupadd [options] groupname

The options can include the GID for the group. For example, to create a new group named “dev” with a GID of 2000, you would use the following command:

groupadd -g 2000 dev

You can also use the “usermod” command to add or remove users from groups. For example, to add joe to the “dev” group, you would use the following command:

usermod -a -G dev joe

To remove joe from the “dev” group, you would use the following command:

gpasswd -d joe dev

Managing groups is an important aspect of maintaining a secure and well-organized Linux system. By understanding the basics of creating and managing users and groups, you can ensure that your users have the access they need to perform their tasks, while still maintaining control over your system’s resources.

In summary, creating and managing users and groups in Linux is a fundamental task for Linux administrators. By using the useradd, usermod, groupadd,

Tags

Linux, Users, Groups, Command Line, Passwords, Security, Performance, Optimization, UID, GID, Home directory, Boot Process, System Administration, Linux Administration, Linux System, Linux Security.

kevin-horvat-Pyjp2zmxuLk-unsplash

How to find when a Linux file is created (Super Geeky Stuff)

In Linux systems, the whole lot is dealt with like a document and essential metadata approximately a document consisting of the advent and modification date are saved in inodes. In this tutorial, we can display you the way to locate document creation time with the usage of debugfs command.

Find file creation time

To get the advent time, you first want to locate the inode quantity of the goal document by using the stat command. The stat command is a command-line tool used to print distinct statistics about a document‘s metadata such as:

  • File size
  • Inode quantity
  • UID & GID of the document
  • I/O Block Access,
  • change and extrade times

You can use the stat command in its primary shape to test the inode quantity of the document the use of the syntax:

$ stat filename

For example:

$ stat file1.txt

The command offers us the inode variety of the file ‘file1.txt’ as 1078474. To bypass all of the different records and simply show the inode variety alone, use the syntax:

$ stat -c %i file_name

For example:

$ stat -c %i file1.txt

Once you’ve got got the inode number, you may continue to effortlessly get the document introduction time the use of the debugfs command the use of the syntax shown:

$  sudo debugfs -R 'stat <inode number>' DEVICE

The DEVICE represents the block tool wherein your document is living for example /dev/sda1, /dev/sda2 etc. To take a look at the block tool run the command:

$ lsblk

Using the inode variety we were given earlier on, the command will consequently be:

$  sudo debugfs -R 'stat <1078474>' /dev/sda

The advent time is prefixed through the directive crtime: as proven withinside the output above. We can see that the record became created at the 13th Fri December 2019 at 01:39:18 hrs. Alternatively, rather than specifying the inode number, you may pass the overall direction to the record as shown:

$  sudo debugfs -R 'stat /home/winnie/file1.txt' /dev/sda1

The above command will yield the equal effects as while you are the usage of the inode number.

Conclusion

And this wraps up this tutorial, hoping Linux might have a simple command to discover record advent time. Here we’ve got used debugfs command to test the advent time of a record.

Tags:

debugfs, debugfs linux, mount debugfs, linux find file, date time, linux time, ubuntu, debian, security