默认root账户是 csh shell
,其他账户是 sh shell
,好安全(难用)啊~~
没有历史命令,没有自动补全^^
当前 shell 长这样子:
root@VM-0-8-freebsd:~ # su jekyll
$
$
目标1: 其他用户切换到 csh 或者 tsh shell
目标2: 安装 bash shell
目标3: 安装传说中的终极shell zsh
一、chsh
命令切换shell
chsh -s SHELL USER
chsh -s /usr/local/bin/bash root
切换用户 jekyll 为 csh shell
root@VM-0-8-freebsd:~ # chsh -s /bin/csh jekyll
chsh: user information updated
root@VM-0-8-freebsd:~ # su - jekyll
To see how long it takes a command to run, type the word "time" before the
command name.
-- Dru <genesis@istar.ca>
jekyll@VM-0-8-freebsd:~ %
切换用户 jekyll 为 tcsh shell
root@VM-0-8-freebsd:~ # chsh -s /bin/tcsh jekyll
chsh: user information updated
root@VM-0-8-freebsd:~ # su - jekyll
In order to make fetch (the FreeBSD downloading tool) ask for
username/password when it encounters a password-protected web page, you can set
the environment variable HTTP_AUTH to 'basic:*'.
jekyll@VM-0-8-freebsd:~ %
jekyll@VM-0-8-freebsd:~ %
二、安装bash shell
pkg install bash
root@VM-0-8-freebsd:~ # chsh -s /usr/local/bin/bash jekyll
chsh: user information updated
root@VM-0-8-freebsd:~ # su - jekyll
You can use aliases to decrease the amount of typing you need to do to get
commands you commonly use. Examples of fairly popular aliases include (in
Bourne shell style, as in /bin/sh, bash, ksh, and zsh):
alias lf="ls -FA"
alias ll="ls -lA"
alias su="su -m"
In csh or tcsh, these would be
alias lf ls -FA
alias ll ls -lA
alias su su -m
To remove an alias, you can usually use 'unalias aliasname'. To list all
aliases, you can usually type just 'alias'.
[jekyll@VM-0-8-freebsd ~]$
[jekyll@VM-0-8-freebsd ~]$
[jekyll@VM-0-8-freebsd ~]$
三、安装 zsh shell
News about ZSH (sourceforge.io)
版本显示最新为 zsh 5.8 。直接通过pkg安装。
pkg install zsh
四、配置zsh shell
sudo 依赖准备工作
pkg install sudo
修改/usr/local/etc/sudoers
文件如下:
%wheel ALL=(ALL) NOPASSWD: ALL
将 jekyll 添加到 wheel 组
root@VM-0-8-freebsd:~ # id jekyll
uid=2001(jekyll) gid=2001(jekyll) groups=2001(jekyll)
root@VM-0-8-freebsd:~ # pw group mod wheel -m jekyll
root@VM-0-8-freebsd:~ # id jekyll
uid=2001(jekyll) gid=2001(jekyll) groups=2001(jekyll),0(wheel)
测试免密sudo
[jekyll@VM-0-8-freebsd ~]$ sudo touch /root/testfile
配置zsh
Oh My Zsh - a delightful & open source framework for Zsh
通过curl安装
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
通过wget安装
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
上面的方式在中国用不了。我们直接http下载install.sh上传到服务器。
手动执行 install.sh
[jekyll@VM-0-8-freebsd ~]$ sh install.sh
Cloning Oh My Zsh...
正克隆到 '/home/jekyll/.oh-my-zsh'...
remote: Enumerating objects: 1286, done.
remote: Counting objects: 100% (1286/1286), done.
remote: Compressing objects: 100% (1242/1242), done.
remote: Total 1286 (delta 25), reused 1049 (delta 24), pack-reused 0
接收对象中: 100% (1286/1286), 1.07 MiB | 119.00 KiB/s, 完成.
处理 delta 中: 100% (25/25), 完成.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to /home/jekyll/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc.
Time to change your default shell to zsh:
Do you want to change your default shell to zsh? [Y/n] y
Changing your shell to /usr/local/bin/zsh...
chsh: user information updated
Shell successfully changed to '/usr/local/bin/zsh'.
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.
• Follow us on Twitter: https://twitter.com/ohmyzsh
• Join our Discord community: https://discord.gg/ohmyzsh
• Get stickers, t-shirts, coffee mugs and more: https://shop.planetargon.com/collections/oh-my-zsh
➜ ~
➜ ~
网友评论