Tag

Linux

31 posts

Linux (pronounced Listeni/ˈlɪnəks/ lin-əks or, less frequently, /ˈlaɪnəks/ lyn-əks) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991 by Linus Torvalds. The Free Software Foundation uses the name GNU/Linux to describe the operating system, which has led to some controversy.

Code

Avoid stuck after ‘SSH2_MSG_SERVICE_ACCEPT received’

It is becoming pretty slow in SSH to a CentOS server.

Trying to print a verbose log:

Bash
$ ssh -vvvv my-host
....
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/user/.ssh/id_rsa RSA SHA256:XXXXX/gNY explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
..... <<<-- long long long silence here
debug3: receive packet: type 51 <<<-- and then continue to access the server
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password

Code

SSH port forwarding

SSH Port Forwarding is a mechanism in SSH for tunneling application ports from the client machine to the server machine, or vice versa.

Suppose we wish to visit a port on a remote machine that is behind a firewall; we can use SSH port forwarding to bind that port to our local machine.

Code

Invoke sudo access to one user/group without password

sudo allows a system administrator to delegate authority to give certain users—or groups of users—the ability to run commands as root or another user while providing an audit trail of the commands and their arguments. It plays a vital role in user controlling.

Code

Here document, another way to write multiline into one file

Here documents are indeed a powerful feature in Unix-like operating systems, allowing for the efficient creation and manipulation of files from within a shell script. They are particularly useful when you need to insert multiple lines of text into a file without having to resort to looping constructs or temporary files.

Code

How to rename your machine

Changing the name of your os could be the first step after initialized you server -- at least it works for me.

Code

diff 和 patch 的使用

linux 下,我们有时候会想要给某个文件打 patch。若不使用 git 等工具,利用 linux 现成的工具,我们也能很容易搞定。

Code

Linux 手动安装字体

一般情况下, 我们有很多工具可以安装字体, 即便在 linux 下, Gnome 等也提供了很多工具来这么做.

不过有时候会有些特殊需求. 比如我们要在某个远程服务器上添加一个字体.

有一些简单的方法可以处理.

Code

普通用户安装rust

rust是mozilla基金委搞出来的一个新语言.

效率上说和c++差不多,作为一个函数式程序,看起来也挺美观.官方的tutorial也做得很不错.目前为止,rust刷版本号已经刷到了1.1了,个人觉得可以试着做点东西了.

Code

fstab 文件格式检查

我们通常编辑 /etc/fstab 来确定启动时候挂载的硬盘, swap 等. 若文件内容有误, 重启后的效果就是直接挂了, 然后必须通过安全模式或者单用户模式进去修改, 这很麻烦.

可否不重启就检查下 fstab 呢? 答案是可以的.