分类 Linux 下的文章

本地转发:

ssh -L [LOCAL_IP:]LOCAL_PORT:DESTINATION:DESTINATION_PORT [USER@]SSH_SERVER
  • [LOCAL_IP:]LOCAL_PORT - The local machine IP address and port number. When LOCAL_IP is omitted, the ssh client binds on the localhost.
  • DESTINATION:DESTINATION_PORT - The IP or hostname and the port of the destination machine.
  • [USER@]SERVER_IP - The remote SSH user and server IP address.
ssh -L 5901:127.0.0.1:5901 -N -f user@remote.host

The -f option tells the ssh command to run in the background and -N not to execute a remote command. We are using localhost because the VNC and the SSH server are running on the same host.

远程转发:

ssh -R [REMOTE:]REMOTE_PORT:DESTINATION:DESTINATION_PORT [USER@]SSH_SERVER
  • [REMOTE:]REMOTE_PORT - The IP and the port number on the remote SSH server. An empty REMOTE means that the remote SSH server will bind on all interfaces.
  • DESTINATION:DESTINATION_PORT - The IP or hostname and the port of the destination machine.
  • [USER@]SERVER_IP - The remote SSH user and server IP address.
GatewayPorts yes

允许从外部访问远程主机转发端口

ssh -R 8080:127.0.0.1:3000 -N -f user@remote.host

The command above will make the ssh server listen on port 8080, and tunnel all traffic from this port to your local machine on port 3000.

https://linuxize.com/post/how-to-setup-ssh-tunneling/

下面是 man apt-get 的摘录。使用 upgrade 时应遵守以下规则:在任何情况下都不得删除当前已安装的软件包,也不得检索和安装尚未安装的软件包。如果这对你很重要,那就用 apt-get upgrade。如果你想让一切 "正常运行",你可能需要使用apt-get dist-upgrade来确保依赖关系得到解决。

upgrade

upgrade 用于从/etc/apt/sources.list 列举的源中安装系统当前安装的所有软件包的最新版本。当前安装的软件包如果有新版本可用,则会被检索和升级;在任何情况下,当前安装的软件包都不会被移除,尚未安装的软件包也不会被检索和安装。当前已安装的软件包的新版本,如果不能在不改变其他软件包安装状态的情况下升级,则会保留其当前版本。必须先进行更新,以便 apt-get 知道新版本的软件包可用。

dist-upgrade

除了执行升级功能外,dist-upgrade 还能智能地处理与新版本软件包的依赖关系变化;apt-get 有一个 "智能 "的冲突解决系统,它会尝试升级最重要的软件包,而命令可能会删除某些软件包。/etc/apt/sources.list文件包含一个位置列表,可以从中获取所需的软件包文件。另请参阅 apt_preferences(5),了解覆盖个别软件包常规设置的机制。