【160123】服务器管理记录

  • Ubuntu Server用户管理

    • List all

      cut -d: -f1 /etc/passwd

    • Create

      sudo useradd [username]
      sudo passwd [username]

    • Delete

      sudo userdel [username]
      sudo rm -rf /home/[username]

    • List UIDs

      awk -F: ‘//home/ {printf “%s:%s\n”,$1,$3}’ /etc/passwd

  • 使用vsftpd搭建ftp服务

    • Install

      sudo apt-get update
      sudo apt-get install vsftpd

    • Configure

      sudo nano /etc/vsftpd.conf

      Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to NO:

    anonymous_enable=NO

      Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to
    

Allow local uses to login by changing the local_enable setting to YES:
> local_enable=YES

    If you want local user to be able to write to a directory, then change the write_enable setting to YES:
> write_enable=YES

    [Solve `530 Login incorrect`](http://askubuntu.com/questions/413677/vsftpd-530-login-incorrect):
> pam_service_name=ftp

    [Solve `550 failed to change directory`](http://my.oschina.net/aiguozhe/blog/100161)
> chroot_local_user=NO

- Run
> sudo service vsftpd restart[/start/stop]