Posts

Showing posts with the label How To

How to ssh tunnel in linux

Image
How to ssh port forwarding ( ssh tunneling) in linux. For example, Client [localhost:10000] ---> Server 1 [port:1111]----->Server 2 [port:22] Server 1 ip address: 192.168.1.12 port: 1111 Server 2 ip address: 192.168.1.13 port: 22 From client, how to login ssh to Server2 via Server1. ssh -p 1111 -f huupv@192.168.1.12 -L 10000:root@192.168.1.13:22  -N ssh -p 10000 root@localhost From client, how to copy files to Server2? scp -r -P 10000 /path/to/file root@localhost:/path/to/folder

How to Setup Chroot SFTP in Linux

Image
How to Setup Chroot SFTP in Linux, it's allow only SFTP, not SSH. I'm running commands as root account. Step 1: To create group groupadd sftpusers Step 2: To create user useradd -g sftpusers -d /home/huupv -s /sbin/nologin huupv passwd huupv Step 3: Setup sftp-server Subsystem in sshd_config  vim /etc/ssh/sshd_config The output as bellow #Subsystem       sftp    /usr/libexec/openssh/sftp-server Subsystem       sftp    internal-sftp Step 4: Specify Chroot Directory for a Group vim /etc/ssh/sshd_config Adding line as following Match Group sftpusers         ChrootDirectory /sftp/%u         ForceCommand internal-sftp Step 5: To create sftp Home Directory mkdir -p /sftp/huupv/home/huupv Step 6: To setup Appropriate Permission chown huupv:sftpusers /sftp/huupv/home/huupv service sshd restart Test chroot sftp To connect from client ssh to server. ssh huupv@172.16....

KeepAlived IP Failover on CentOS & Red Hat

Image
Introduction Learn how to set up Keepalived for IP failover on CentOS and Red Hat. This step-by-step guide ensures high availability and network redundancy, keeping your critical services online during hardware or network failures. In the world of high availability and network redundancy, ensuring that your critical services remain operational despite hardware or network failures is paramount. Keepalived is a robust and versatile tool designed to provide IP failover solutions on Linux servers, particularly on CentOS and Red Hat distributions. This guide delves into the configuration and deployment of Keepalived for IP failover, ensuring that your services continue to run smoothly even in the face of unexpected downtimes. Whether you're an IT professional aiming to bolster your infrastructure or a systems administrator looking to implement a reliable failover mechanism, this tutorial offers step-by-step instructions to help you achieve high availability with Keepalived. Keepalived ...

How to create LVM in centos 6

Image
in this post, I'm demo "How to create LVM in centos 6". To run commands as root account!. The scripts for create LVM ( Logical Volume Management ): OS: Centos HDD1: /dev/sdb HDD2: /dev/sdc Step 1: Adding a new partition use fdisk command fdisk /dev/sdb1 fdisk /dev/sdc1 The output as bellow Command (m for help): m Command action    a   toggle a bootable flag    b   edit bsd disklabel    c   toggle the dos compatibility flag    d   delete a partition    l   list known partition types    m   print this menu    n   add a new partition    o   create a new empty DOS partition table    p   print the partition table    q   quit without saving changes    s   create a new empty Sun disklabel    t   change a partition's system id    u   change display/entry units   ...

How to installing and configuring DRBD

Introduction Learn how to install and configure DRBD (Distributed Replicated Block Device) on two Linux nodes for high availability. This step-by-step guide ensures your data is secure and replicated across servers. In today's digital age, ensuring the availability and redundancy of data is crucial for maintaining a robust IT infrastructure. One powerful tool that system administrators rely on for this purpose is DRBD (Distributed Replicated Block Device). DRBD allows you to mirror the content of block devices, such as hard drives, between servers over a network. This ensures that if one server fails, the other can take over without any data loss. This guide will walk you through the process of installing and configuring DRBD on two Linux nodes. By the end of this tutorial, you will have a fully functional DRBD setup that can be used to enhance the reliability and availability of your data. Installation Environment Node 1: FQDN: node1.huuphan.local HDD1: 10GB (/dev/sda1) HDD2: 1GB...

How To Install the BIND DNS Server on CentOS 6

Image
In my post, I demonstrate how to install and configure the BIND DNS server. I execute the following commands as the root account. Links to articles you may like: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat To prepare package for BIND DNS server. yum update -y yum install bind bind-utils -y yum -y install perl perl-core wget openssh-clients openssh-server unzip nmap sysstat rsync telnet ntp ntpdate asia.pool.ntp.org service ntpd start chkconfig ntpd on To configure the static IP address: # vim /etc/sysconfig/network-scripts/ifcfg-eth1 The content is as follows: DEVICE=eth1 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=static IPADDR=192.168.131.10 NETMASK=255.255.255.0 GATEWAY=192.168.131.2 DNS=192.168.131.10 DNS1=8.8.8.8 DNS2=8.8.4.4 USERCTL=no PEERDNS=no To configure hosts file. vi...