Merge pull request #6 from LCTT/master

Update 20140728
This commit is contained in:
cvsher 2014-07-28 21:35:52 +08:00
commit 3b4978be33
12 changed files with 233 additions and 185 deletions

View File

@ -0,0 +1,58 @@
编程的乐趣:快速终止!
================================================================================
![](http://www.opensourceforu.com/wp-content/uploads/2011/12/fail-350x262.jpg)
> 当软件出现问题的时候,它应该以一种很容易引起注意的方式马上终止。这种“快速终止”的方式值得借鉴,我们会在这期专栏里谈谈这个重要的概念。
一开始“快速终止”看上去是一种会影响可靠性的不好的实践——为什么一个系统在还可以继续运行的时候要崩溃或者说终止对于这个我们需要理解快速终止是和Heisenbugs对于不易复现bug的一种称呼紧密联系在一起的。
考虑一下Bohrbugs对于能够重现的bug的一种称呼它们在一个给定输入的条件下总是会出现比如访问空指针。这类问题很容易测试、复现并修复。而如今所有有经验的程序员应该都面对过这样的情形导致崩溃的bug在重启软件后就不再出现了。不管花多少时间或努力去重现问题那个bug就是跟我们捉迷藏。这种bug被称为Heisenbugs。
花在寻找、修复和测试Heisenbugs上的努力比起Bohrbugs来说要高出一个数量级。一种避免Heisenbugs的策略是将它们转化为Bohrbugs。怎么做呢预测可能导致Heisenbugs的因素然后尝试将它们变成Bohrbugs。是的这并不简单而且也并不是一定可行但是让我们来看一个能产生效果的特殊例子。
并发编程是Heisenbugs经常出现的一个典范。我们的例子就是一个Java里和并发相关的问题。在遍历一个Java集合的时候一般要求只能通过Iterator的方法对集合进行操作比如remove()方法。而在遍历期间,如果有另一个线程尝试修改底层集合(因为编程时留下的错误),那么底层集合就可能会被破坏(例如,导致不正确的状态)。
类似这种不正确的状态会导致不确定的错误——假如我们幸运的话实际上这很不幸程序可以继续执行而不会崩溃但是却给出错误的结果。这种bug很难重现和修复因为这一类的程序错误都是不确定的。换句话说这是个Heisenbug。
幸运的是Java Iterators会尝试侦测这种并发修改并且当发现时会抛出异常`ConcurrentModificationException`而不是等到最后再出错——那样也是没有任何迹象的。换句话说Java Iterators也遵从了“快速终止”的方法。
如果一个`ConcurrentModificationException`异常在正式版软件中发生了呢根据在Javadoc里对这个异常的说明它“只应该被用于侦测bug”。换句话说`ConcurrentModificationException`只应该在开发阶段监听和修复,而不应该泄漏到正式代码中。
好吧如果正式软件确实发生了这个异常那它当然是软件中的bug应当报告给开发者并修复。至少我们能够知道曾经发生过一次针对底层数据结构的并发修改尝试而这是软件出错的原因而不是让软件产生错误的结果或是以其他现象延后出错这样就很难跟踪到根本原因
“防止崩溃”的途径就意味着开发健壮的代码。一个很好的编写容错代码的例子就是使用断言。很可惜的是,关于断言的使用有大量不必要的公开争论。其中主要的批评点是:它在开发版本中使用,而在发布版中却被关掉的。
不管怎么样这个批评是错误的从来没有说要用断言来替代应该放到发布版软件中的防御式检查代码。例如断言不应该用来检查传递给函数的参数是否为空。相应的应该用一个if语句来检查这个参数是否正确否则的话抛出一个异常或是提前返回来适合上下文。然而断言一般可以用于额外检查代码中所作出的假设这些假设应该一直为真才正常。例如用一个语句来检查在进行了入栈操作后栈应该不是空的例如对“不变量”的检查
所以,快速终止,随时中断,那么你就走在开发更加健壮代码的道路上了。
--------------------------------------------------------------------------------
via:http://www.opensourceforu.com/2011/12/joy-of-programming-fail-fast/
译者:[zpl1025](https://github.com/zpl1025) 校对:[ReiNoir](https://github.com/reinoir)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:
[2]:
[3]:
[4]:
[5]:
[6]:
[7]:
[8]:
[9]:
[10]:
[11]:
[12]:
[13]:
[14]:
[15]:
[16]:
[17]:
[18]:
[19]:
[20]:

View File

@ -1,6 +1,6 @@
@@ -1,63 +0,0 @@
Linux基础如何在命令行中查看目录的大小
Linux基础如何在命令行中查看目录的大小
=====================================================================
这是写给Liunx新用户的一系列文章中的第一篇在这系列文章我将会写一些对新用户来说非常好用的**Linux基础命令**。
**注意**本文的目标读者是仅有小量甚至是没有任何Linux命令行使用经验的读者。
@ -59,7 +59,7 @@ Linux基础如何在命令行中查看目录的大小
via: http://www.unixmen.com/linux-basics-find-size-directory-commands/
译者:[cvsher](https://github.com/cvsher) 校对:[校对者ID](https://github.com/校对者ID)
译者:[cvsher](https://github.com/cvsher) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,6 +1,6 @@
ncdu 基于Ncurses库的磁盘使用分析器
ncdu 基于ncurses库的磁盘使用分析器
================================================================================
[Ncdu][1] (NCurses Disk Usage) 是一个基于Ncurses库的du命令浏览器. 它通过众所周知的[du][2]命令,为用户提供一个快速且容易被使用的接口. 它显示磁盘使用的百分比且允许你通过ncurses库去浏览目录.
[Ncdu][1] (NCurses Disk Usage) 是一个基于Ncurses库的du命令的界面。它通过大家熟知的[du][2]命令为用户提供一个快速且容易被使用的界面。它可以显示磁盘使用的百分比且允许你使用ncurses库的方式在目录之间导航。
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu-about.png)
@ -8,37 +8,37 @@ ncdu 基于Ncurses库的磁盘使用分析器
ncdu已经被移植到大多数linux发行版本可从官方资源库中安装.
Arch / Manajaro and Derivatives:
Arch / Manajaro 及其衍生版:
sudo pacman -S ncdu
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu.png)
Ubuntu / Debian / Linux Minut and Derivatives:
Ubuntu / Debian / Linux Minut 及其衍生版:
sudo apt-get install ncdu
Fedora and Derivatives:
Fedora 及其衍生版:
sudo yum install ncdu
在[这里][3]检查其他的发行版本.
在[这里][3]可以找到其他的发行版。
### 使用 ncdu ###
Keys:
键盘操作:
- up, k — Move cursor up
- down, j Move cursor down
- right/enter — Open selected directory
- left, <, h — Open parent directory
- n — Sort by name (ascending/descending)
- s — Sort by size (ascending/descending)
- C Sort by items (ascending/descending)
- d Delete selected file or directory
- t — Toggle dirs before files when sorting
- g Show percentage and/or graph
- up, k — 向上移动光标
- down, j 向下移动光标
- right/enter — 打开选定的目录
- left, <, h — 打开父目录
- n — 按文件名排序(升序/降序)
- s — 按文件大小排序(升序/降序)
- C 按项目数排序(升序/降序)
- d 删除选定的文件或目录
- t — 排序时将目录放在文件前面
- g 以图形方式显示百分比
为使用ncdu请打开终端并且运行
@ -48,7 +48,7 @@ Keys:
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu-scanning.png)
当扫描完成后,你能够很容易的看文件/目录的大小.
当扫描完成后,你能够很容易的看文件/目录的大小.
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/done-scanning.png)
@ -60,8 +60,8 @@ Keys:
man ncdu
**荣誉**: 有两位读者**BasketCase**和**Sama Vim**在阅读[Linux Basics: How To Find Size of Directory Commands][5]之后 向我们推荐Ncdu工具.
注:上面这个链接已经做成原文
**荣誉**: 有两位读者**BasketCase**和**Sama Vim**在阅读“[Linux基础如何在命令行中查看目录的大小][5]”之后 向我们推荐了这个Ncdu工具。
Enjoy!
@ -69,7 +69,7 @@ Enjoy!
via: http://www.unixmen.com/ncdu-ncurses-disk-usage-analyzer/
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[校对者ID](https://github.com/校对者ID)
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
@ -77,4 +77,4 @@ via: http://www.unixmen.com/ncdu-ncurses-disk-usage-analyzer/
[2]:http://www.unixmen.com/linux-basics-find-size-directory-commands/
[3]:http://dev.yorhel.nl/ncdu
[4]:http://dev.yorhel.nl/ncdu/man
[5]:http://www.unixmen.com/linux-basics-find-size-directory-commands/
[5]:http://linux.cn/article-3473-1.html

View File

@ -1,3 +1,4 @@
nd0104 is translate
Time to Upgrade: Ubuntu 13.10 Support Ends Today
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/04/upgrade-available.jpg)

View File

@ -0,0 +1,44 @@
Translating by lfzark
CoreOS Stable Release
================================================================================
First off, [Happy SysAdmin Day][1]. We think we have a pretty good SysAdmin surprise in store for you today as we are announcing the CoreOS stable release channel. Starting today, you can begin running CoreOS in production. This version is the most tested, secure and reliable version available for users wanting to run CoreOS. This is a huge milestone for us. Since our first alpha release in August 2013:
- 191 releases have been tagged
- Tested on hundreds of thousands of servers on the alpha and beta channels
- Supported on 10+ platforms, ranging from bare metal to being primary images on Rackspace and Google
It is a big day for us here at CoreOS, as we have been working hard to deliver the stable release. Of course, we couldnt do this without the community so thank you for all of your support and contributions to the project.
[CoreOS 367.1.0][2], our first version on the stable channel, includes the following:
- Linux 3.15.2
- Docker 1.0.1
- Support on all major cloud providers, including Rackspace Cloud, Amazon EC2 (including HVM), and Google Compute Engine
- Commercial support via [CoreOS Managed Linux][3]
This is a great opportunity to read about our [Update Philosophy][4] if you haven't already done so.
Please note: The stable release is not including etcd and fleet as stable, this release is only targeted at the base OS and Docker 1.0. etcd/fleet stable support will be in subsequent releases.
For those of you who want to start running CoreOS in production be sure to review our quick [Switching Release Channels][5] guide. As you're booting new machines, be sure to base them off your desired channel from the beginning.
Finally, thanks to the community for your support. We cant wait to hear your feedback. For those looking for additional support of running CoreOS in production, be sure to check out our [Managed Linux][6] offerings, as we have a full support team in place ready to answer any questions you may have.
Happy SysAdmin Day, and thank you for making the web awesome.
--------------------------------------------------------------------------------
via: https://coreos.com/blog/stable-release/
作者Alex Polvi
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://sysadminday.com/
[2]:https://coreos.com/releases/#367.1.0
[3]:https://coreos.com/products/managed-linux/
[4]:https://coreos.com/using-coreos/updates/
[5]:https://coreos.com/docs/cluster-management/setup/switching-channels/
[6]:https://coreos.com/products/managed-linux/

View File

@ -1,3 +1,4 @@
[bazz2 hehe]
How to use systemd for system administration on Debian
================================================================================
Soon enough, hardly any Linux user will be able to escape the ever growing grasp that systemd imposes on Linux, unless they manually opt out. systemd has created more technical, emotional, and social issues than any other piece of software as of late. This predominantly came to show in the [heated discussions][1] also dubbed as the 'Init Wars', that occupied parts of the Debian developer body for months. While the Debian Technical Comittee finally decided to include systemd in Debian 8 "Jessie", there were efforts to [supersede the decision][2] by a General Resolution, and even threats to the health of developers in favor of systemd.
@ -103,4 +104,4 @@ via: http://xmodulo.com/2014/07/use-systemd-system-administration-debian.html
[1]:https://lists.debian.org/debian-devel/2013/10/msg00444.html
[2]:https://lists.debian.org/debian-devel/2014/02/msg00316.html
[3]:http://0pointer.de/blog/projects/systemd.html
[4]:http://www.freedesktop.org/wiki/Software/systemd/
[4]:http://www.freedesktop.org/wiki/Software/systemd/

View File

@ -1,3 +1,4 @@
translating by cvsher
Command Line Tuesdays Part Five
================================================================================
Yes, youve guessed what time it is! Its time to rrrrrrrrummmbleeeee! And this time, well learn how to work with commands. So without further ado, lets get to business.
@ -85,4 +86,4 @@ via: https://news.opensuse.org/2014/07/15/command-line-tuesdays-part-five/
[17]:
[18]:
[19]:
[20]:
[20]:

View File

@ -1,89 +0,0 @@
How to configure chroot SFTP in Linux
================================================================================
There are **some scenario** where system admin wants only few users should be allowed to transfer files to Linux boxes not ssh. We can achieve this by setting up **SFTP** in chroot environment.
### Background of SFTP & chroot : ###
**SFTP** stands for **SSH File Transfer protocol or Secure File Transfer Protocol**. SFTP provides file access, file transfer, and file management functionalities over any reliable data stream. When we configure SFTP in chroot environment , then only allowed users will be limited to their **home directory** , or we can say allowed users will be in jail like environment where they cant even change their directory.
In article we will configure **Chroot SFTP in RHEL 6.X** & **CentOS 6.X**. We have one user **Jack** , this users will be allowed to transfer files on linux box but no ssh access.
### Step:1 Create a group ###
[root@localhost ~]# groupadd sftp_users
### Step:2 Assign the secondary group(sftp_users) to the user. ###
If the users doesnt exist on system , use below command :
[root@localhost ~]# useradd -G sftp_users -s /sbin/nologin jack
[root@localhost ~]# passwd jack
For **already existing users** , use below usermod command :
[root@localhost ~]# usermod G sftp_users -s /sbin/nologin jack
**Note** : if you want to change the **default home directory** of users , then use **-d** option in useradd and usermod command and set the **correct permissions**.
### Step:3 Now edit the config file “/etc/ssh/sshd_config” ###
# vi /etc/ssh/sshd_config
#comment out the below line and add a line like below
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# add Below lines at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
#### Where : ####
- **Match Group sftp_users** This indicates that the following lines will be matched only for users who belong to group sftp_users
- **ChrootDirectory %h** This is the path(default user's home directory) that will be used for chroot after the user is authenticated. So, for Jack, this will be /home/jack.
- **ForceCommand internal-sftp** This forces the execution of the internal-sftp and ignores any command that are mentioned in the ~/.ssh/rc file.
Restart the ssh service
# service sshd restart
### Step:4 Set the Permissions : ###
[root@localhost ~]# chmod 755 /home/jack
[root@localhost ~]# chown root /home/jack
[root@localhost ~]# chgrp -R sftp_users /home/jack
If You want that jack user should be allowed to upload files , then create a upload folder with the below permissions ,
[root@localhost jack]# mkdir /home/jack/upload
[root@localhost jack]# chown jack. /home/jack upload/
### Step:5 Now try to access the system & do testing ###
Try to access the system via ssh
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/ssh-try.png)
As You can see below jack user is logged in via SFTP and can't change the directory becuase of chroot environment.
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/sftp-login.png)
Now do the **uploading and downloading** testing as shown below:
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/sftp-upload-download.png)
As we can see above , both uploading & downloading working fine for jack user.
--------------------------------------------------------------------------------
via: http://www.linuxtechi.com/configure-chroot-sftp-in-linux/
原文作者:[Pradeep Kumar][a]
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxtechi.com/author/pradeep/

View File

@ -1,3 +1,4 @@
nd0104 is translate
Install Google Docs on Linux with Grive Tools
================================================================================
Google Drive is two years old now and Googles cloud storage solution seems to be still going strong thanks to its integration with Google Docs and Gmail. Theres one thing still missing though: a lack of an official Linux client. Apparently Google has had one floating around their offices for a while now, however its not seen the light of day on any Linux system.

View File

@ -1,58 +0,0 @@
编程的乐趣:快速出错!
================================================================================
![](http://www.opensourceforu.com/wp-content/uploads/2011/12/fail-350x262.jpg)
> 当软件出现问题的时候,它应该以一种能引起注意的方式马上终止。这种“快速出错”的方式值得借鉴,我们会在这期专栏里谈谈这个重要的概念。
一开始“快速出错”看上去是一种会影响可靠性的不好的实践为什么一个系统在还可以继续运行的时候要崩溃或者说终止对于这个我们需要理解快速出错是和Heisenbugs对于不能复现bug的一种称呼紧密联系在一起的。
考虑一下Bohrbugs对于能够重现的bug的一种称呼它们在给定输入的时候总是会出现比如访问空指针。这类问题很容易测试复现并修复。如今所有有经验的程序员应该都面对过这样的情形导致崩溃的bug在重启软件后不再出现了。不管花多少时间或努力去重现问题那个bug就是跟我们捉迷藏。这种bug被称为Heisenbugs。
花在寻找修复和测试Heisenbugs上的努力比起Bohrbugs来说要高出一个数量级。一种避免Heisenbugs的策略是将它们转化为Bohrbugs。怎么做呢预测可能导致Heisenbugs的因素然后尝试将它们变成Bohrbugs。是的这并不简单而且也并不是一定就能成功但是让我们来看一个能产生效果的特殊例子。
并发编程是Heisenbugs经常出现的一个典范。我们的例子就是一个Java里和并发相关的问题。在遍历一个Java集合的时候一般要求只能通过Iterator的方法比如remove()方法。而当遍历的时候,如果有另一个线程尝试修改底层集合(因为编程时留下的错误),那么底层集合就可能会被破坏(例如,导致不正确的状态)。
类似这种不正确的状态会导致不确定的错误假如我们幸运的话实际上这很不幸程序可以继续执行而不会崩溃但是却给出错误的结果。这种bug很难重现和修复因为这一类的程序错误都是不确定的。换句话说这是个Heisenbug。
幸运的是Java Iterators会尝试侦测这种并发修改在发现了以后会丢出异常`ConcurrentModificationException`而不是等到最后再出错那样也是没有任何迹象的。换句话说Java Iterators也遵从了“快速出错”的方法。
如果异常`ConcurrentModificationException`在正式软件中发生了呢根据在Javadoc里对这个异常的说明它“只应该用于侦测bug”。换句话说`ConcurrentModificationException`只应该在开发阶段监听和修复,而不应该泄漏到正式代码中。
好吧如果正式软件确实发生了这个异常那它当然是软件中的bug应当报告给开发者并修复。至少我们能够知道发生了一次底层数据结构的并发修改而这是软件出错的原因而不是让软件产生错误的结果或是以其他现象延后出错这样就很难跟踪到根本原因
“安全出错”的方法意味着开发健壮的代码。一个很好的编写安全出错代码的例子就是使用断言。很可惜的是,关于断言的使用有大量不必要的公开争论。其中主要的批评点是:它在开发版本中使用,而在发布版中却被关掉的。
不管怎么样这个批评是错误的从来没有说用断言来替代应该放到发布版软件中的防御式检查代码。例如断言不应该用来检查传递给函数的参数是否为空。相应的应该用一个if语句来检查这个参数是否正确否则的话抛出异常或是提前返回来适合上下文。然而断言一般用于额外检查代码中所做出的假设它们应该为真才正常。例如用一个语句来检查在进行了入栈操作后栈应该不是空的例如对“不变量”的检查
所以,快速出错,随时中断,那么你已经走在开发更加健壮代码的道路上了。
--------------------------------------------------------------------------------
via:http://www.opensourceforu.com/2011/12/joy-of-programming-fail-fast/
译者:[zpl1025](https://github.com/zpl1025) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:
[2]:
[3]:
[4]:
[5]:
[6]:
[7]:
[8]:
[9]:
[10]:
[11]:
[12]:
[13]:
[14]:
[15]:
[16]:
[17]:
[18]:
[19]:
[20]:

View File

@ -1,22 +1,22 @@
在Ubuntu上显示桌面歌词
Ubuntu 桌面上显示歌词
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/display_lyrics_desktop_Ubuntu.jpeg)
除了免费的流媒体音乐外,我最喜欢[Spotify][1]的地方就是它的歌词插件了。有时候我听不懂一首歌里面的所有歌词尤其是rap。[TuneWiki][2]插件在这种情况下就派得上用场了。但TuneWiki仅有支持Windows和iTune的插件那我们在linux桌面上有什么选择呢
如果你使用过Linux桌面一段时间,你也许听过[OSD Lyrics][3]。它是一个显示桌面歌词的小程序。你可以借助一些音乐播放器来使用它比如Rythmbox[Banshee][4][Clementine][5]等等。
如果你使用过一段时间Linux桌面你也许听过[OSD Lyrics][3]。它是一个显示桌面歌词的小程序。你可以借助一些音乐播放器来使用它,比如 Rythmbox[Banshee][4][Clementine][5]等等。
### 在Ubuntu 14.04和Linux mint 17上安装OSD Lyrics ###
两年以前OSD Lyrics在它的官方仓库中被积极地维护但现在对它的开发已经停止了。尽管这个PPA已经不可用但可以通过网络下载OSD Lyrics的安装包。虽然这些安装执行文件最初是为Ubuntu 12.02设计的但这些文件也能在Ubuntu 14.04上很良好地工作。我们一起看看怎么在UUUUbuntu 14.04和 Linux mint 17上安装OSD Lyrics。
两年以前 OSD Lyrics 在它的官方仓库中被积极地维护但现在对它的开发已经停止了。尽管这个PPA已经不可用但可以通过网络下载OSD Lyrics的安装包。虽然这些安装执行文件最初是为 Ubuntu 12.02 设计的,但这些文件也能在 Ubuntu 14.04 上良好地工作。我们一起看看怎么在 Ubuntu 14.04 和 Linux mint 17 上安装OSD Lyrics。
[前往下载页下载OSDLyrics][6],根据你是使用[32位还是64位的ubuntu][7]来下载相应的.deb 文件。你会在网页的上方找到这些文件。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/OSD_Lyrics_Download.jpeg)
下载完成后,通过双击它来使用Ubuntu软件中心来安装。另外你也可以使用[Gdebi ][8]来快速地安装.deb安装包。
下载完成后,双击它通过使用Ubuntu软件中心来安装。另外你也可以使用[Gdebi ][8]来快速地安装.deb安装包。
### 怎样在Ububtu和linux mnit 上使用OSD Lyrics使用歌词 ###
### 怎样在 Ububtu 和 linux mnit 上使用 OSD Lyrics 显示歌词 ###
安装完成后你可以从Unity Dash运行OSD Lyrics :
@ -26,20 +26,20 @@
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/OSD_Lyrics_Default_Player.jpeg)
有一件事值得注意那就是OSD Lyrics不像[Shazam][9]等一样,它不是通过音频来寻找歌词,而是通过比如名称,专辑,艺术家等信息来关联音乐文件。所以你得确保你的音乐文件的来源正当,或者是你得保持你的音乐文件的信息是正确和已经更新了的。
有一件事值得注意那就是OSD Lyrics不像[Shazam][9]等软件一样,它不是通过音频来寻找歌词,而是通过比如名称,专辑,艺术家等信息来关联音乐文件。所以你得确保你的音乐文件的来源正当,或者是你得保持你的音乐文件的信息是正确并且是已经更新后的。
如果OSD Lyrics辨认出了音乐文件它就会用卡拉OK格式在桌面上显示歌词了:译者注OSD Lyrics可以自动在千千静听和虾米歌词站点在线下载歌词这对我们中文用户来说是个福音
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Dsiplay_Lyrics_Ubuntu.jpeg)
OSD Lyrics有大量设置选项你可以改变歌词字体的种类,大小等等其它许多设置
OSD Lyrics有大量设置选项你可以改变歌词字体文字大小等等。
你认为OSD Lyrics怎么样你使用其它的一些歌词插件吗闲余时间请和我们分享你的看法
--------------------------------------------------------------------------------
你认为 OSD Lyrics 怎么样?你还使用其它歌词插件吗?欢迎您和我们分享
--------------------------------------------------------------------------------
via: http://itsfoss.com/display-song-lyrics-desktop-ubuntu-1404/
译者:[Love-xuan](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
译者:[Love-xuan](https://github.com/译者ID) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
@ -51,4 +51,4 @@ via: http://itsfoss.com/display-song-lyrics-desktop-ubuntu-1404/
[6]:https://code.google.com/p/osd-lyrics/downloads/list
[7]:http://itsfoss.com/how-to-know-ubuntu-unity-version/
[8]:http://itsfoss.com/install-deb-files-easily-and-quickly-in-ubuntu-12-10-quick-tip/
[9]:http://www.shazam.com/
[9]:http://www.shazam.com/

View File

@ -0,0 +1,89 @@
在Linux中为SFTP配置chroot环境
================================================================================
在**某些环境**中系统管理员想要允许极少数用户传输文件到Linux盒子中而非ssh。要实现这一目的我们可以使用**SFTP**并为其构建chroot环境。
### SFTP & chroot背景 ###
**SFTP**是值**SSH文件传输协议SSH File Transfer protocol或安全文件传输协议Secure File Transfer Protocol**它提供了任何可信数据流下的文件访问、文件传输以及文件管理功能。当我们为SFTP配置chroot环境后只有被许可的用户可以访问并被限制到它们的**家目录**中,或者我们可以这么说:被许可的用户将处于牢笼环境中,在此环境中它们甚至不能切换它们的目录。
在本文中,我们将配置**RHEL 6.X** & **CentOS 6.X中的SFTP Chroot环境**。我们开启一个用户帐号‘**Jack**该用户将被允许在Linux盒子上传输文件但没有ssh访问权限。
### 步骤1 创建组 ###
[root@localhost ~]# groupadd sftp_users
### 步骤2 分配附属组(sftp_users)给用户 ###
如果用户在系统上不存在,使用以下命令创建:
[root@localhost ~]# useradd -G sftp_users -s /sbin/nologin jack
[root@localhost ~]# passwd jack
对于**已经存在的用户**使用以下usermod命令进行修改
[root@localhost ~]# usermod G sftp_users -s /sbin/nologin jack
**注意**:如果你想要修改用户的**默认家目录**那么在useradd和usermod命令中使用**-d**’选项,并设置**合适的权限**。
### 步骤3 现在编辑配置文件 “/etc/ssh/sshd_config” ###
# vi /etc/ssh/sshd_config
#comment out the below line and add a line like below
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# add Below lines at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
#### 此处: ####
- **Match Group sftp_users** 该参数指定以下的行将仅仅匹配sftp_users组中的用户
- **ChrootDirectory %h** 该参数指定用户验证后用于chroot环境的路径默认的用户家目录。对于Jack该路径就是/home/jack。
- **ForceCommand internal-sftp** 该参数强制执行内部sftp并忽略任何~/.ssh/rc文件中的命令。
重启ssh服务
# service sshd restart
### 步骤4 设置权限: ###
[root@localhost ~]# chmod 755 /home/jack
[root@localhost ~]# chown root /home/jack
[root@localhost ~]# chgrp -R sftp_users /home/jack
如果你想要允许jack用户上传文件那么创建一个上传文件夹设置权限如下
[root@localhost jack]# mkdir /home/jack/upload
[root@localhost jack]# chown jack. /home/jack upload/
### 步骤5 现在尝试访问系统并进行测试 ###
尝试通过ssh访问系统
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/ssh-try.png)
正如下图所示用户jack通过SFTP登录而且因为chroot环境不能切换目录。
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/sftp-login.png)
现在进行**上传和下载**测试,如下图:
![](http://www.linuxtechi.com/wp-content/uploads/2014/07/sftp-upload-download.png)
正如上图所示jack用户的上传下载功能都工作得很好。
--------------------------------------------------------------------------------
via: http://www.linuxtechi.com/configure-chroot-sftp-in-linux/
原文作者:[Pradeep Kumar][a]
译者:[GOLinux](https://github.com/GOLinux) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxtechi.com/author/pradeep/