วันเสาร์ที่ 9 กรกฎาคม พ.ศ. 2565

Linux_sFTP

SFTP  

#C7254E

#F9F2F4


::add_user 

usermod -l newuser userA

$ useradd newuser

$ useradd -d /home/newuser -m -G sftponly newuser


::add_group

$ groupmod -n sftponly sftp

$ groupadd sftponly

$ grep 'sftponly' /etc/group


::add_member_to_group

$ usermod -a -G sftponly newuser

$ usermod -d /home/newuser newuser


::SFTP

$ chmod 755 /home/newuser

$ chown root:root /home/newuser


$ chmod 700 /home/newuser/upload

$ chown newuser:newuser /home/newuser/upload

OR

$ chmod 777 /home/newuser/upload

$ chown root:root /home/newuser/upload




$ vi /etc/ssh/sshd_config


#Subsystem sftp /usr/lib/openssh/sftp-server
#PasswordAuthentication yes

Subsystem sftp internal-sftp
#Match Group *,!sudo
Match Group sftponly
ForceCommand internal-sftp -d /upload
PasswordAuthentication yes
ChrootDirectory %h
AllowTcpForwarding no
X11Forwarding no


$ systemctl restart sshd



วันจันทร์ที่ 4 กรกฎาคม พ.ศ. 2565

Ubuntu 22 LTS

 Ubuntu 22 LTS


::VM-Tool install

$ mount /dev/cdrom /media

$ tar xzvf /media/VMwareTools-x.x.x-xxxx.tar.gz -C /tmp/

cd /tmp/vmware-tools-distrib/

./vmware-install.pl

./vmware-install.pl -d default


$ umount /media

$ rm /tmp/VMwareTools-x.x.x-xxxx.tar.gz
rm -rf /tmp/vmware-tools-distrib


::Upgrade 

$ apt update 

$ apt upgrade -y

$ apt-get install -f 



::Check version

$ lsb_release -a 



::SET Regional

timedatectl

$ unlink /etc/localtime

$ ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime

timedatectl 


::SET Hostname

$ vi /etc/hostname

::Host file

$ vi /etc/hosts

127.0.0.1 localhost
127.0.1.1 apitms
10.90.8.37 apitms apitms.sher.com
10.50.2.102 sap sap.sher.com
10.50.2.102 sapprd sapprd.sher.com
10.50.2.104 saprqa saprqa.sher.com
10.30.2.104 sapdev sapdev.sher.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


::Network-mon

ip r

ip a 

resolvectl status 

--

netplan apply

netplan --debug apply



::Network-Config


vi /etc/netplan/xx-xx-xx.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens32:
      addresses:
      - 10.61.10.30/24
      nameservers:
        addresses:
        - 10.90.8.28
        search:
        - shera.com
      routes:
      - to: default
        via: 10.61.10.254
  version: 2



::DISABLE_IPv6

ip a | grep inet6


vi /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"

update-grub


vi /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

$ sysctl -p

$ cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6

ip a | grep inet6


::Add_New user and grant root privilege 

$ useradd -s /bin/bash -d /home/newuser/ -m -G sudo newuser 

$ passwd newuser

   or

usermod -aG sudo newuser

::verify

$ su - newuser

grep '^sudo' /etc/group


::Add root users

$ useradd -s /bin/bash -d /home/newuser/ -m -ou 0 -g 0 newuser 

$ passwd newuser

grep newuser /etc/passwd

::verify

$ su - newuser

$ vi ~/.bash_profile

cd /


::History_Clear 

$ history -c