locale warning 怎么办

新配置的 vps 在 apt-get 时常常出现

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

网上搜索了一下解决方案,这里做个笔记


编辑 local 文件

vi /var/lib/locales/supported.d/local

输入以下内容

# This file names the currently supported and somewhat tested locales.
# If you have any additions please file a glibc bug report.
en_US.UTF-8 UTF-8
en_US ISO-8859-1
en_US.ISO-8859-15 ISO-8859-15
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
zh_CN GB2312

重新生成一次 locale 即可

locale-gen --purge

Ubuntu 14 使用 root 登录 vps

今天再买了个 BudgetVM 的 vps,镜像使用 Ubuntu 14.04,创建后总是无法使用 root 进行 ssh 登录,随后发了 ticket 询问得到回复:

I see you have Ubuntu. Ubuntu 14 has disabled root login via SSH.

You will either need to enable the root login via SSH by directly editing /etc/ssh/sshd_config or creating an additional account with sudo privileges. You may do this by using the serial console function of your client area.

A "one liner" to complete this via command line is:

sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

Make sure you restart SSH services after.

他们镜像的 Ubuntu 14 禁止了 root 登录,在 /etc/ssh/sshd_config 修改后重启即可。

PermitRootLogin yes

Node.js 把 user/group 名称转换成 uid/gid

http server 侦听到 sock 文件时,出于安全考虑把 sock 文件修改成指定的用户名和用户组,fs 模块的 chown 只能传入 uid/gid 参数,因此需要把 user/group 名称转换成 uid/gid,因此有了下面的这一个模块。

https://www.npmjs.com/package/userid

由于模块使用 c 扩展,相信性能会比纯 JavaScript 的模块好不少,有兴趣可以试试下面这个使用 JavaScript 回调命令行的同类模块,下载量也很高。

https://www.npmjs.com/package/uid-number