Category: Linux

  • Local ubuntu server (yyhome) configurations

    * rtorrent
    * ubuntu
    lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.4 LTS
    Release: 20.04
    Codename: focal

    $ hostname
    yyhome

    # cat sshd_config | grep -vE ‘^#|^$’
    Include /etc/ssh/sshd_config.d/*.conf
    Port 22
    Port 33
    ChallengeResponseAuthentication no
    UsePAM yes
    X11Forwarding yes
    PrintMotd no
    AcceptEnv LANG LC_*
    Subsystem sftp /usr/lib/openssh/sftp-server
    PasswordAuthentication no
    Match user jpuyy address 192.168.1.0/24
    PasswordAuthentication yes

    https://www.speedtest.net/apps/cli

    $ apt list –upgradable

    # apt install mlocate

    2023-05-23

    upgrade from Ubuntu 20.04.6 LTS to 22.04.2 LTS
    Run ‘do-release-upgrade’ to upgrade to it.

    # do-release-upgrade

    Do you want to start the upgrade?

    4 packages are going to be removed. 112 new packages are going to be
    installed. 688 packages are going to be upgraded.

    You have to download a total of 702 M. This download will take about
    5 minutes with your connection.

    Installing the upgrade can take several hours. Once the download has
    finished, the process cannot be canceled.

    Continue [yN] Details [d]y

  • ubuntu wsl2

    # install zsh
    $ sudo apt install zsh

    https://ohmyz.sh/#install

    snap not working

    $ uname -a
    Linux jpuyy-PC 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04.4 LTS
    Release:        20.04
    Codename:       focal
    
    $ sudo snap install go --classic
    error: cannot communicate with server: Post http://localhost/v2/snaps/go: dial unix /run/snapd.socket: connect: no such file or directory
    
    $ sudo systemctl status snapd
    System has not been booted with systemd as init system (PID 1). Can't operate.
    Failed to connect to bus: Host is down
    
    $ sudo snap version
    snap    2.54.3+20.04.1ubuntu0.2
    snapd   unavailable
    series  -
    
    $ sudo snap list
    

    https://blog.csdn.net/exzds/article/details/121454177

    # install go

    https://www.digitalocean.com/community/tutorials/how-to-install-go-on-ubuntu-20-04

  • start_smb.sh

    sudo docker stop samba
    sudo docker rm samba
    sudo docker run -it --name samba -v /data/4t/share:/mount -p 139:139 -p 445:445 -d dperson/samba -p \
    -s "public;/mount"
    

    之后使用客户端使用 guest 用户登录

  • sftp chroot

    # cat /etc/ssh/sshd_config  | grep -vE '^#|^$'
    AuthorizedKeysCommand /usr/bin/google_authorized_keys
    AuthorizedKeysCommandUser root
    HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_ecdsa_key
    HostKey /etc/ssh/ssh_host_ed25519_key
    SyslogFacility AUTHPRIV
    PermitRootLogin no
    AuthorizedKeysFile      .ssh/authorized_keys
    PasswordAuthentication no
    ChallengeResponseAuthentication no
    GSSAPIAuthentication yes
    GSSAPICleanupCredentials no
    UsePAM yes
    X11Forwarding yes
    ClientAliveInterval 420
    UseDNS no
    AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    AcceptEnv XMODIFIERS
    Subsystem sftp internal-sftp
    Match User user1
       ChrootDirectory /data/chroot/%u
       ForceCommand internal-sftp
       AllowTcpForwarding no
       X11Forwarding no
    

    https://serverfault.com/a/656756

  • alpine apk

    apk add bash curl tcpdump bind-tools busybox-extras

  • badblocks check disk

    家里的 linux 用了好长时间了,运行一下

    badblocks -v /dev/sda1 > /tmp/sda1-badsectors.txt
    Checking blocks 0 to 3907016703
    Checking for bad blocks (read-only test):