曹佳润

Jerry Cao

Welcome to my homepage. The English version is coming very soon. Please stay tuned.


Basic Server Tips

1. 新建服务器用户

连接服务器 如果直接连接不上,需要用一个代理(socks5)连接:

ssh -o "ProxyCommand /usr/bin/nc -X 5 -x 127.0.0.1:1080 %h %p" -p 22 root@$someip

添加语言

sudo locale-gen "en_US.UTF-8"  
sudo dpkg-reconfigure locales

新建名为demo的用户

useradd --create-home --system --shell /bin/bash demo

# 如果建错了,需要修改 home 位置则执行:
sudo usermod -d /new/place/will/be/created -m demo

修改demo密码

passwd demo

使用 visudo 添加 demo 用户到 sudoer 列表中,从而可以使用 sudo 命令

EDITOR=vim visudo

在上述文件中新添加一行

demo ALL=(ALL:ALL) ALL

2. 上传与下载

从服务器下载文件

scp username@servername:/path_remote /path_local

上传本地文件到服务器

scp /path/filename username@servername:/path   

从服务器下载整个目录

scp -r username@servername:/var/www/remote_dir/(远程目录) /var/www/local_dir(本地目录

上传目录到服务器

scp  -r local_dir username@servername:remote_dir

3. vim显示中文乱码

设置~下的.vimrc文件(或在/etc/vim/目录下),加上:

set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1

如果是Debian系统:

set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
set enc=utf8
set fencs=utf8,gbk,gb2312,gb18030

4. 登录服务器

ssh cjr@172.18.32.93

5. Gobalprotect vpn connection command line

globalprotect connect --portal vpnconnect-standard.manchester.ac.uk

6. log in UoM server

ssh a29830jc@csf3.itservices.manchester.ac.uk

7. log in GPU node

qrsh -l v100 -pe smp.pe 8 -cwd bash
  • v100 = N (Number of GPUs, one as default)
  • smp.pe [number] (Number of CPUs)

8. Download and upload

Upload a file from your local machine to your CSF scratch directory

rsync -avz myinput.dat username@csf3.itservices.manchester.ac.uk:~/scratch/

Download a file from your CSF scratch directory to your local machine (don’t forget the . at the end to mean the current folder on your PC)

rsync -avz username@csf3.itservices.manchester.ac.uk:~/scratch/myresult.dat

Donation

取消

Thanks for your kindly support!

扫码支持
扫码支持
Please scan the QR code

The donation will be used to maintain this website