From 458c35e29d537171a922747ee331b560ffde1548 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 15:03:17 +0800 Subject: [PATCH 1/3] PRF --- ... your calendar with khal and vdirsyncer.md | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md index a84fc3c917..d9b618dc3c 100644 --- a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Organize and sync your calendar with khal and vdirsyncer) @@ -9,14 +9,16 @@ 使用 khal 和 vdirsyncer 组织和同步你的日历 ====== -保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 -![Calendar close up snapshot][1] + +> 保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 + +![](https://img.linux.net.cn/data/attachment/album/202001/23/150009wsr3d5ovg4g1vzws.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 khal 和 vdirsyncer 跟踪你的日程 -处理日历很_麻烦_,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败“之一][2]以来,我已经取得了一些进步。 +处理日历很*麻烦*,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败"之一][2]以来,我已经取得了一些进步。 目前使用日历最困难的是一直需要以某种方式在线共享。两种最受欢迎的在线日历是 Google Calendar 和 Microsoft Outlook/Exchange。两者都在公司环境中大量使用,这意味着我的日历必须支持其中之一或者两个。 @@ -28,10 +30,9 @@ ![vdirsyncer][6] -Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 pip 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 - -在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保同步对设置将 Google Calendar 设置为冲突解决的”赢家“。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: +Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 `pip` 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 +在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保设置你的同步对,将 Google Calendar 设置为冲突解决的“赢家”。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: ``` [general] @@ -56,12 +57,11 @@ path = "~/.calendars/Personal" fileext = ".ics" ``` -在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 **khal configure** 进行初始设置。 +在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 `khal configure` 进行初始设置。 ![Configuring khal][8] -现在,运行 **khal interactive** 将显示本文开头的界面。输入 **n** 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历向条目添加颜色还可以帮助你确定日历内容: - +现在,运行 `khal interactive` 将显示本文开头的界面。输入 `n` 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历,向条目添加颜色还可以帮助你确定日历内容: ``` [calendars] @@ -76,7 +76,7 @@ path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m color = brown ``` -现在,当你运行 **khal interactive** 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 +现在,当你运行 `khal interactive` 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 ![Adding a new calendar entry][9] @@ -89,7 +89,7 @@ via: https://opensource.com/article/20/1/open-source-calendar 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -103,3 +103,4 @@ via: https://opensource.com/article/20/1/open-source-calendar [6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) [7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google [8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) +[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png From 4c8ab4d99ab79191d80aedfedf2eeb9795a2d07d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 15:03:47 +0800 Subject: [PATCH 2/3] PUB @geekpi https://linux.cn/article-11812-1.html --- ...rganize and sync your calendar with khal and vdirsyncer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 Organize and sync your calendar with khal and vdirsyncer.md (98%) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/published/20200115 Organize and sync your calendar with khal and vdirsyncer.md similarity index 98% rename from translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md rename to published/20200115 Organize and sync your calendar with khal and vdirsyncer.md index d9b618dc3c..5ddb647095 100644 --- a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/published/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11812-1.html) [#]: subject: (Organize and sync your calendar with khal and vdirsyncer) [#]: via: (https://opensource.com/article/20/1/open-source-calendar) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From e563950e4a348260579074b8aa9bb2ebce42708c Mon Sep 17 00:00:00 2001 From: FSSlc Date: Thu, 23 Jan 2020 17:49:35 +0800 Subject: [PATCH 3/3] [Translated] 20200117 Locking and unlocking accounts on Linux systems.md Signed-off-by: FSSlc --- ...and unlocking accounts on Linux systems.md | 118 ------------------ ...and unlocking accounts on Linux systems.md | 109 ++++++++++++++++ 2 files changed, 109 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20200117 Locking and unlocking accounts on Linux systems.md create mode 100644 translated/tech/20200117 Locking and unlocking accounts on Linux systems.md diff --git a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md deleted file mode 100644 index 469874c4ed..0000000000 --- a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Locking and unlocking accounts on Linux systems) -[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Locking and unlocking accounts on Linux systems -====== -There are times when locking a Linux user account is necessary and times when you need to reverse that action. Here are commands for managing account access and what's behind them. -SQBack / Getty Images - -If you are administering a [Linux][1] system, there will likely be times that you need to lock an account. Maybe someone is changing positions and their continued need for the account is under question; maybe there’s reason to believe that access to the account has been compromised. In any event, knowing how to lock an account and how to unlock it should it be needed again is something you need to be able to do. - -One important thing to keep in mind is that there are multiple ways to lock an account, and they don't all have the same effect. If the account user is accessing an account using public/private keys instead of a password, some commands you might use to block access to an account will not be effective. - -### Locking an account using the passwd command - -One of the simplest ways to lock an account is with the **passwd -l** command. For example: - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ sudo passwd -l tadpole -``` - -The effect of this command is to insert an exclamation point as the first character in the encrypted password field in the /etc/shadow file. This is enough to keep the password from working. What previously looked like this (note the first character): - -``` -$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: -``` - -will look like this: - -``` -!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: -``` - -On his next login attempt (should there be one), tadpole would probably try his password numerous times and not gain access. You, on the other hand, would be able to check the status of his account with a command like this (-S = status): - -``` -$ sudo passwd -S tadpole -tadpole L 10/15/2019 0 99999 7 -1 -``` - -The "L" in the second field tells you that the account is locked. Before the account was locked, it would have been a "P". An "NP" would mean that no password was set. - -**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][3] ]** - -The **usermod -L** command would have the same effect (inserting the exclamation character to disable use of the password). - -One of the benefits of locking an account in this way is that it's very easy to unlock the account when and if needed. Just reverse the change by removing the added exclamation point with a text editor or, better yet, by using the **passwd -u** command. - -``` -$ sudo passwd -u tadpole -passwd: password expiry information changed. -``` - -The problem with this approach is that, if the user is accessing his or her account with public/private keys, this change will not block their use. - -### Locking accounts with the chage command - -Another way to lock a user account is to the the **chage** command that helps manage account expiration dates. - -``` -$ sudu chage -E0 tadpole -$ sudo passwd -S tadpole -tadpole P 10/15/2019 0 99999 7 -1 -``` - -The **chage** command is going to make a subtle change to the /etc/shadow file. The eighth field in that colon-separated file (shown below) will be set to zero (previously empty) and this means the account is essentially expired. The **chage** command tracks the number of days between password changes, but also provides account expiration information when this option is used. A zero in the eiighth field would mean that the account expires a day after January 1, 1970, but also simply locks it when a command like that shown above is used. - -``` -$ sudo grep tadpole /etc/shadow | fold -tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC -nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: - ^ - | - +--- days until expiration -``` - -To reverse this change, you can simply remove the 0 that was placed in the /etc/shadow entry for the user with a command like this: - -``` -% sudo chage -E-1 tadpole -``` - -Once an account is expired in this way, even passwordless [SSH][4] will not provide access. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md new file mode 100644 index 0000000000..d22b9d114a --- /dev/null +++ b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Locking and unlocking accounts on Linux systems) +[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 系统中禁用与解禁用户的账号 +====== +总有这样的时候:有时你需要禁用某位 Linux 用户的账号,有时你还需要反过来解禁用户的账号。 +本文将介绍一些管理用户访问的命令,并介绍它们背后的原理。 + +假如你正管理着一台 [Linux][1] 系统,那么很有可能将遇到需要禁用一个账号的情况。可能是某人已经换了职位,他们是否还需要该账号仍是个问题;或许有理由相信再次使用该账号并没有大碍。不管上述哪种情况,知晓如何禁用账号并解禁账号都是你需要知道的知识。 + +需要你记住的一件重要的事是尽管有多种方法来禁用账号,但它们并不都达到相同的效果。假如用户使用公钥/私钥来使用该账号而不是使用密码来访问,那么你使用的某些命令来阻止用户获取该账号或许将不会生效。 + +### 使用 `passwd` 来禁用一个账号 + +最为简单的用来禁用一个账号的方法是使用 `passwd -l` 命令。例如: + +``` +$ sudo passwd -l tadpole +``` + +上面这个命令的效果是在加密后的密码文件 `/etc/shadow` 中,用户对应的那一行的最前面加上一个 `!` 符号。这样就足够阻止用户使用密码来访问账号了。 +在没有使用上述命令前,加密后的密码行如下所示(请注意第一个字符): + +``` +$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +而禁用该账号后,这一行将变为: + +``` +!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +在 tadpole 下一次尝试登录时, 他可能会使用他原有的密码来尝试多次登录,但就是无法再登录成功了。另一方面,你则可以使用下面的命令来查看他这个账号的状态(-S = status): + +``` +$ sudo passwd -S tadpole +tadpole L 10/15/2019 0 99999 7 -1 +``` + +第二项的 `L` 告诉你这个账号已经被禁用了。在该账号被禁用前,这一项应该是 `P`。如果显示的是 `NP` 则意味着该账号还没有设置密码。 + +命令 `usermod -L` 也具有相同的效果(添加 `!` 来禁用账号的使用)。 + +使用这种方法来禁用某个账号的一个好处是当需要解禁某个账号时非常容易。只需要使用一个文本编辑器或者使用 `passwd -u` 命令来执行相反的操作,即将添加的 `!` 移除即可。 + +``` +$ sudo passwd -u tadpole +passwd: password expiry information changed. +``` + +但使用这种方式的问题是如果用户使用公钥/私钥对的方式来访问他/她的账号,这种方式将不能阻止他们使用该账号。 + +### 使用 `chage` 命令来禁用账号 + +另一种禁用用户账号的方法是使用 `chage` 命令,它可以帮助管理用户账号的过期日期。 + +``` +$ sudu chage -E0 tadpole +$ sudo passwd -S tadpole +tadpole P 10/15/2019 0 99999 7 -1 +``` + +`chage` 命令将对 `/etc/shadow` 文件做出显著的变化。在这个使用 `:` 来分隔的文件(下面将进行展示)中,某行的第 8 项将被设置为 `0` (先前为空),这就意味着这个账号已经过期了。 `chage` 命令将追踪密码更改期间的日期数目,但给出选项是它也可以提供账号过期信息。第 8 项如果是 0 则意味着这个账号在 1970 年 1 月 1 日后的一天过期,当使用上面显示的那个命令时也可以用来禁用账号。 + +``` +$ sudo grep tadpole /etc/shadow | fold +tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC +nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: + ^ + | + +--- days until expiration +``` + +为了执行相反的操作,你可以简单地使用下面的命令将放置在 `/etc/shadow` 文件中的 `0` 移除掉: + +``` +% sudo chage -E-1 tadpole +``` + +一旦一个账号使用这种方式被禁用,即便是免密的 [SSH][4] 登录也不能再访问该账号了。 + +最后请加入我们在 [Facebook][5] 和 [LinkedIn][6] 上的社区来对你感兴趣的话题进行评论。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world