Skip to Content
bash shell脚本编程经典实例 (第2版)
book

bash shell脚本编程经典实例 (第2版)

by Carl Albing, JP Vossen
January 2021
Intermediate to advanced
581 pages
15h 7m
Chinese
Posts & Telecom Press
Content preview from bash shell脚本编程经典实例 (第2版)
编写安全的
shell
脚本
309
极大地减少了输入口令的次数。有了
keychain
,在本地主机每次重启时输入口令
即可。
keychain
还使得远程
cron
作业能够轻松安全地“挂接”(
hook in
)在长期运行的
ssh-agent
进程上,这样就允许脚本利用基于密钥的登录(
key-based login
)。
shell
脚本
keychain
不仅精巧、质量上乘,而且注释详尽,先前我们讨论过的那些将环境
变量导到其他会话的烦琐过程,都可以通过
keychain
实现自动化并进行管理。而且还能
使其为脚本和
cron
所用。但你可能会自问:先等一下,你想让我把自己所有的密钥交给
keychain
,直到重启主机为止?没错,不过这并没有听起来那么糟糕。
首先,你随时都能终止
keychain
,不过这也使得脚本或
cron
无法再使用它。其次,
--clear
选项可以在你登录时冲洗掉已缓存的密钥。听起来怎么又倒退了?其实这么做是
有道理的。
keychain
的作者给出了详细的解释(首发于
IBM developerWorks
)。
我解释过使用未经加密的私钥是一种危险的做法,因为这会使得别人盗取你的私
钥,无须输入密码就能用它从任何系统登入你的远程账户。好吧,虽然
keychain
不易受到这种滥用的影响(只要坚持使用加密过的私钥),但存在一个可能会被
利用的弱点,这直接与以下事实相关:
keychain
使其很容易“挂接”到长期运行
ssh-agent
进程。我在想,要是入侵者能够通过某种途径得到我的密码或口令
来登录本地系统,那会怎么样?如果他们以我的身份登录 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

bash 网络安全运维

bash 网络安全运维

Paul Troncone, Carl Albing
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9787115553782