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 [email protected] -L 10000:[email protected]: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 [email protected] The output as bellow [email protected]'s password: This service all

KeepAlived IP Failover on CentOS & Red Hat

Image
Links to below you maybe likes: 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 Keepalived use highly available to make Virtual IP call VIP . it's a linux implementation make of VRRP my post, use keepAlived IP Failover on CentOS & Red Hat. I'm running commands as root account. Links to below you maybe likes: 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 install keepalived on centos  yum update -y yum install -y keepalived To configure keepalived On Node 1 ! Configuration File for keepalived global_defs {    notification_email {      [email protected]      [email protected]    }    notif

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    v   verify the partition table    w   write table to disk and exit    x   extra functionality (experts only) Command (m for help): n Command action    e   extended    p   primary

How to installing and configuring DRBD

Image
The scenario  install and configure DRBD Node1: FQDN: node1.huuphan.local HDD1: 10GB (/dev/sda1) HDD2: 1GB (/dev/sdb1) Node2: FQDN: node2.huuphan.local HDD1: 10GB (/dev/sda1) HDD2: 1GB (/dev/sdb1) Note:  device /dev/sdb a unpartitioned for 2 node. Selinux: disabled mode sed -i 's/SELINUX=enforcing/SELINUX=disable/' /etc/sysconfig/selinux To installing NTP for two node yum install ntp ntpdate -y To iptables firewall to allow 7788 port iptables -I eth1 -m state --state NEW -m tcp -p tcp --dport 7788 -j ACCEPT service iptables save To configure /etc/hosts file vim /etc/hosts The output as bellow 172.16.235.145 node1.huuphan.local node1 172.16.235.146 node2.huuphan.local node2 To create /dev/sdb1 device  for two node fdisk -l fdisk /dev/sdb The output as bellow Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xa3977c63. Changes will remain in memory only, un

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