In this guide we are going to set up an sftp server on an Arch Linux
system. We will also set up a form of chroot where users can only access
sftp with the shared credentials.
The File Transfer Protocol is a standard communication protocol used
for the transfer of computer files from a server to a client on a
computer network.
FTP isn’t popular today because it Lacks Security. When a file is
sent using this protocol, the data, username, and password are all
shared in plain text, which means a hacker can access this information
with little to no effort. For data to be secure, you need to use an
upgraded version of FTP like SFTP.
SFTP Secure File Transfer Protocol is a file transfer protocol that
provide secure access to a remote computer to deliver secure
communications. It leverages SSH – Secure Socket Shell and is frequently
also referred to as ‘Secure Shell File Transfer Protocol’.
$ sudo systemctl status sshd ● sshd.service - OpenSSH Daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2021-12-03 10:19:02 UTC; 17min ago Main PID: 467 (sshd) Tasks: 1 (limit: 4606) Memory: 5.0M CGroup: /system.slice/sshd.service └─467 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
Dec 04 14:53:30 ip-10-2-40-103 sshd[13109]: Unable to negotiate with 141.98.10.246 port 34078: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:53:42 ip-10-2-40-103 sshd[13111]: Unable to negotiate with 141.98.10.246 port 38674: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:53:53 ip-10-2-40-103 sshd[13115]: Unable to negotiate with 141.98.10.246 port 43268: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:54:05 ip-10-2-40-103 sshd[13117]: Unable to negotiate with 141.98.10.246 port 47864: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:54:17 ip-10-2-40-103 sshd[13119]: Unable to negotiate with 141.98.10.246 port 52460: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:54:41 ip-10-2-40-103 sshd[13123]: Unable to negotiate with 141.98.10.246 port 33418: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:54:53 ip-10-2-40-103 sshd[13127]: Unable to negotiate with 141.98.10.246 port 38014: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 14:55:05 ip-10-2-40-103 sshd[13129]: Unable to negotiate with 141.98.10.246 port 42614: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exc> Dec 04 15:16:10 ip-10-2-40-103 sshd[13191]: Received disconnect from 61.177.173.21 port 60983:11: [preauth] Dec 04 15:16:10 ip-10-2-40-103 sshd[13191]: Disconnected from authenticating user root 61.177.173.21 port 60983 [preauth]
Now that we have installed the necessary software and created the
users and groups, let us configure ssh.
Ensure password authentication is enabled for ssh. Edit the config
file here /etc/ssh/sshd_config:
1
sudo vim /etc/ssh/sshd_config
Then ensure this line is not commented:
1
PasswordAuthentication yes
Next, we need to add rules for the users in
the sftpusers group to be considered as sftp. Edit the
config file:
1
sudo vim /etc/ssh/sshd_config
Add this content at the bottom of the file:
1 2 3 4 5
Match Group sftpusers X11Forwarding no AllowTcpForwarding no ChrootDirectory /srv/sftp ForceCommand internal-sftp
Then restart sshd to reload the config:
1
sudo systemctl restart sshd
Verify that sshd is running as expected:
1 2 3 4 5 6 7 8 9 10 11 12 13
$ sudo systemctl status sshd ● sshd.service - OpenSSH Daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2021-12-04 15:48:19 UTC; 18s ago Main PID: 14269 (sshd) Tasks: 1 (limit: 4606) Memory: 892.0K CGroup: /system.slice/sshd.service └─14269 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
Dec 04 15:48:19 ip-10-2-40-103 systemd[1]: Started OpenSSH Daemon. Dec 04 15:48:19 ip-10-2-40-103 sshd[14269]: Server listening on 0.0.0.0 port 22. Dec 04 15:48:19 ip-10-2-40-103 sshd[14269]: Server listening on :: port 22.
Now we have sftp server up and running with a user configured!
The users will be able to login to the server and access files and
directories located in their home directory. If you want to give the
user to other directories outside their own directory, just make sure
the user has enough rights to access. These directories and files have
to be within the sftp directory – /srv/sftp.
Example: if i want user to access the
directory /srv/sftp/paymentfiles, do the following:
Create the directory
1
sudo mkdir /srv/sftp/paymentfiles
Then assign the user(citizix) access by making them own
the directory:
GPU核函数的启动方式是异步的:启动GPU函数后,CPU不会等待GPU函数执行完毕才执行下一行代码。必要时,需要调用cuda.synchronize(),告知CPU等待GPU执行完核函数后,再进行CPU端后续计算。这个过程被称为同步,也就是GPU执行流程图中的红线部分。如果不调用cuda.synchronize()函数,执行结果也将改变,"print
by
cpu.将先被打印。虽然GPU函数在前,但是程序并没有等待GPU函数执行完,而是继续执行后面的cpu_print函数,由于CPU调用GPU有一定的延迟,反而后面的cpu_print先被执行,因此cpu_print的结果先被打印了出来。
今天获得了一个微形的USB无线网卡,其在Windows下是可以自动安装驱动程序的,因为此USB网卡中包含了Windows版的驱动程序。但是我现在想在Archlinux下使用这个USB无线网卡作为Wifi的发射无线信息供手机上网使用,而windows驱动就无能为力了。通过将USB无线网卡插入到windows电脑上配置好wifi就可以查询到此网卡的具体型号为realtek 8188gu wireless lan 802.11n usb nic linux,
而使用
pacman -Ss无法找到realtek相关驱动,于是使用paru查找:
paru -Ss realtek |grep 8188gu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Driver for Realtek RTL8188CUS (8188C, 8192C) chipset wireless cards aur/8188eu-dkms v4.3.0.8_13968-17 [+25 ~0.14] Driver for Realtek RTL8188EUS (RTL8188EUS, RTL8188ETV) WLAN aur/8188eu-aircrack-dkms-git 5.3.9.r196.3fae723-5 [+7 ~0.00] Realtek RTL8188EUS and RTL8188ETV Wi-Fi driver with monitor mode & frame injection support aur/8188eu-dkms-git 5.2.2.4.r794.53ed527-3 [+5 ~0.00] Standalone driver for Realtek RTL8188EUS (RTL8188EUS, RTL8188ETV) WLAN aur/8188fu-kelebek333-dkms-git r115.751882b-1 [+4 ~0.00] [无人维护] Kernel driver module for Realtek RTL8188FU and RTL8188FTV Wireless 802.11n USB 2.0 adapters (device id 0bda:f179), for kernel versions < 6 aur/8188fu-dkms-git r13.586d795-1 [+3 ~0.00] [无人维护] Kernel driver module for Realtek RTL8188FU and RTL8188FTV Wireless 802.11n USB 2.0 adapters (device id 0bda:f179), for kernel versions less than 5.8 Kernel module for Realtek RTL8188SU/RTL8191SU/RTL8192SU devices aur/8188fu-supremegamers-dkms-git r120.40d4a49-1 [+2 ~0.00] Kernel driver module for Realtek RTL8188FU and RTL8188FTV Wireless 802.11n USB 2.0 adapters (device id 0bda:f179), for kernel versions 6.0 and 6.1 aur/rtl8188gu-dkms-git r10.699d0cc-1 [+2 ~0.00] [已安装:r12.9dec829-1] Linux driver for Realtek RTL8188GU