martes, 31 de agosto de 2021

Servidor ftp para apache

yum -y install vsftpd

systemctl status vsftpd

getenforce

vim /etc/vsftpd/vsftpd.conf

local_enable=YES

anonymous_enable=NO

anon_root=/home/pmb7
local_root=/var/www/html/PMB7
chroot_local_user=YES
allow_writeable_chroot=YES

 

cat /etc/group |grep ftp

useradd -g ftp -d /home/pmb7 pmb7

passwd pmb7 

systemctl restart vsftpd

getfacl /var/www/html/PMB7 

# file: PMB7/
# owner: apache
# group: apache
user::rwx
group::r-x
other::r-x

 

setfacl -m "u:pmb7:rwx" PMB7/

getfacl PMB7/
# file: PMB7/
# owner: apache
# group: apache
user::rwx
user:pmb7:rwx
group::r-x
mask::rwx
other::r-x

 

find PMB7/ -type d -exec chmod 2775 {} \;

find PMB7/ -type f -exec chmod ug+rw {} \;

getfacl PMB7/
# file: PMB7/
# owner: apache
# group: apache
# flags: -s-
user::rwx
user:pmb7:rwx
group::r-x
mask::rwx
other::r-x

find PMB7 -type f -exec chmod 644 {} \;

 

usermod -s /sbin/nologin pmb7

 vim  /etc/pam.d/vsftpd

Comentar la linea

 #auth       required     pam_shells.so

 

systemctl restart vsftpd

 

Fuente:

https://dimitar.me/how-to-create-an-ftp-user-and-allow-write-to-the-apache-root-directory-with-proper-permissions/

https://wiki.archlinux.org/title/Access_Control_Lists_(Espa%C3%B1ol)

https://comoinstalar.me/como-instalar-ftp-en-centos-7/

https://www.muylinux.com/2014/10/15/servidor-ftp-centos-7/



 

miércoles, 18 de agosto de 2021

how to see your hard disk i/o performance? iotop

iotop -oPa

 Total DISK READ :       0.00 B/s | Total DISK WRITE :     105.77 K/s
Actual DISK READ:       0.00 B/s | Actual DISK WRITE:      52.89 K/s
  PID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                                                                     
 2269 be/4 postgres      0.00 B    120.00 K  0.00 %  0.48 % postgres: wal writer process
  991 be/3 root          0.00 B     44.00 K  0.00 %  0.06 % [jbd2/dm-1-8]
  877 be/4 root          0.00 B      0.00 B  0.00 %  0.01 % [kworker/0:2]
 3072 be/4 postgres      0.00 B     56.00 K  0.00 %  0.00 % postgres: odoo sgecfe [local] idle in transaction
 2070 be/4 root          0.00 B      4.00 K  0.00 %  0.00 % rsyslogd -n 


You can execute dd to write one file and see iotop

dd if=/dev/zero of=diskbench bs=1M count=1024 conv=fdatasync


Funte: 

https://haydenjames.io/linux-server-performance-disk-io-slowing-application/

jueves, 29 de julio de 2021

Aumentar particion en Centos

 

If you are running a virtual server and need to extend a disk you can resize a partition and volume group without rebooting the server. If done correctly this process is non destructive to existing data.

Assuming your disk is /dev/sda and standard RHEL/CentOS partitioning:

Extend partition

fdisk /dev/sda

Enter p to print your initial partition table.

Enter d (delete) followed by 2 to delete the existing partition definition (partition 1 is usually /boot and partition 2 is usually the root partition).

Enter n (new) followed by p (primary) followed by 2 to re-create partition number 2 and enter to accept the start block and enter again to accept the end block which is defaulted to the end of the disk.

Enter t (type) then 2 then 8e to change the new partition type to "Linux LVM".

Enter p to print your new partition table and make sure the start block matches what was in the initial partition table printed above.

Enter w to write the partition table to disk. You will see an error about device or resource busy which you can ignore.

Update kernel in-memory partition table

After changing your partition table, run the following command to update the kernel in-memory partition table:

partx -u /dev/sda

Resize physical volume

Use this command to resize the PV to recognize the extra space

pvresize /dev/sda2

Resize LV and filesystem

In this command centos is the PV, root is the LV and /dev/sda2 is the partition that was extended. Use pvs and lvs commands to see your physical and logical volume names if you don't know them. The -r option in this command resizes the filesystem appropriately so you don't have to call resize2fs or xfs_growfs separately.

lvextend -r centos/root /dev/vda2
 

La fuente:

https://community.webcore.cloud/tutorials/linux_specific_articles/how_to_extend_partition_with_unallocated_space_cen/