From f872ca4b1cb79468a624b13ce5db8389986a0dbe Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 18 Mar 2015 11:29:59 +0800 Subject: [PATCH] =?UTF-8?q?20150318-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0150318 Fedora GNOME Keyboard Shortcuts.md | 211 ++++++++++++++++++ ...irectory with Samba on Fedora or CentOS.md | 144 ++++++++++++ 2 files changed, 355 insertions(+) create mode 100644 sources/tech/20150318 Fedora GNOME Keyboard Shortcuts.md create mode 100644 sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md diff --git a/sources/tech/20150318 Fedora GNOME Keyboard Shortcuts.md b/sources/tech/20150318 Fedora GNOME Keyboard Shortcuts.md new file mode 100644 index 0000000000..7b70ec9779 --- /dev/null +++ b/sources/tech/20150318 Fedora GNOME Keyboard Shortcuts.md @@ -0,0 +1,211 @@ +Fedora GNOME Keyboard Shortcuts +================================================================================ +To get the very best out of the [GNOME desktop environment][1], within Fedora, you need to learn and remember the keyboard shortcuts required to navigate the system. + +This article lists the most useful keyboard shortcuts and how they are used. + +![GNOME Keyboard Shortcuts - The Super Key. ](http://f.tqn.com/y/linux/1/L/o/K/1/gnomekeyboardshortcut1.png) +GNOME Keyboard Shortcuts - The Super Key. + +#### 1. The Super Key #### + +[The "super" key][2] is your best friend when navigating modern operating systems. + +On a standard laptop the "super" key sits on the bottom row next to the "alt" key. + +When you press the "super" key the "activities" overview will be displayed and you will be able to see all of the open applications zoomed out. + +Pressing "ALT" and "F1" together will show the same display. + +![GNOME Run Command.](http://f.tqn.com/y/linux/1/L/p/K/1/runcommand.png) +GNOME Run Command. + +### 2. How To Run A Command Quickly ### + +If you need to run a command quickly, you can press "ALT" and "F2" which displays a "Run Command" dialog. + +You can now enter your command into that window and press return. + +![TAB Through Applications.](http://f.tqn.com/y/linux/1/L/q/K/1/tabthroughwindows.png) +TAB Through Applications. + +### 3. Quickly Switch To Other Open Applications ### + +As with Microsoft Windows you can switch applications using the "ALT" and "TAB" keys. + +On some keyboards the tab key looks like this: **|<- ->|** and on others it simply spells the word "TAB". + +The GNOME application switcher simply shows the icons and names of the applications as you tab through them. + +If you hold down the "shift" and "tab" keys, the application switcher rotates around the icons in reverse order. + +![Switch Windows In The Same Application.](http://f.tqn.com/y/linux/1/L/r/K/1/switchwindowsinsameapplication.png) +Switch Windows In The Same Application. + +### 4. Quickly Switch To Another Window In The Same Application ### + +If you are anything like me then you will end up with half a dozen instances of Firefox open. + +You now know that "Alt" and "Tab" switch between applications. + +There are two ways to cycle through all of the open instances of the same application. + +The first is to press "Alt" and "Tab" until the cursor sits over the icon of the application with many windows that you wish to cycle through. After a pause a dropdown will appear and you can select the Window with the mouse. + +The second and preferred option is to press "Alt" and "Tab" until the cursor sits over the icon of the application you want to cycle through and then press the "super" and "`" keys to toggle through the open instances. + +**Note that the "`" key is the one just above the tab key. The key for cycling through the open instances is always the key above the tab key regardless of your keyboard layout, therefore it isn't always guaranteed to be the "`" key.** + +If you have nimble fingers (or as I like to call them ninja fingers) then you can hold the "shift", "`" and "super" key to cycle backwards through the open instances of an application. + +![Switch Keyboard Focus.](http://f.tqn.com/y/linux/1/L/s/K/1/switchkeyboardfocus.png) +Switch Keyboard Focus. + +### 5. Switch Keyboard Focus ### + +This keyboard shortcut isn't essential but a nice to know. + +If you want to switch the keyboard focus to the search bar or to an application window you can press "CTRL", "ALT" and "TAB". to show a list of possible areas to switch to. + +You can then use the arrow keys to cycle through the possible options. + +![Show All Applications.](http://f.tqn.com/y/linux/1/L/t/K/1/showapplications.png) +Show All Applications. + +### 6. Show A List Of All The Applications ### + +If the last one was a nice to have then this one is a real time saver. + +To quickly navigate to a full list of all the applications on your system press the "super" key and "A". + +![Switch Workspaces.](http://f.tqn.com/y/linux/1/L/u/K/1/switchworkspaces.png) +Switch Workspaces. + +### 7. Switch Workspaces ### + +If you have been using Linux for a while you will appreciate the fact that you [can use multiple workspaces][3]. + +For instance in one workspace you might have development environments open, in another web browsers and in a third your email client. + +To toggle between workspaces press the "super" and the "Page Up" (PGUP) keys to toggle in one direction and the "super", "Page Down" (PGDN) keys to toggle in the other direction. + +The alternative but more longwinded away to switch to another workspace is to press the "super" key to show a list of applications and then select the workspace you wish to switch to on the right side of the screen. + +![Move Application To Another Workspace.](http://f.tqn.com/y/linux/1/L/v/K/1/movetoanewworkspace.png) +Move Application To Another Workspace. + +### 8. Move Items To A New Workspace ### + +If the workspace you are using is getting cluttered and you wish to move the current application to a new workspace press the "super", "shift" and "page up" button or "super", "shift" and "page down" key. + +Alternatively press the "super" key to bring up the list of applications and drag the application you wish to move to one of the workspaces on the right of the screen. + +![Show The Message Tray.](http://f.tqn.com/y/linux/1/L/w/K/1/showmessagetray.png) +Show The Message Tray. + +### 9. Show The Message Tray ### + +The message tray provides a list of notifications. + +To bring up the message tray press the "super" and "M" key on the keyboard. + +Alternatively move the mouse to the bottom right corner of the screen. + +![Lock The Screen.](http://f.tqn.com/y/linux/1/L/x/K/1/lockscreen.png) +Lock The Screen. + +### 10. Lock The Screen ### + +Need to a comfort break or a cup of coffee? Don't want sticky paws all over your keyboard? + +Whenever you leave your computer alone get in the habit of pressing "super" and L to lock the screen. + +To unlock the screen drag up from the bottom and enter your password. + +![Control Alt Delete Within Fedora.](http://f.tqn.com/y/linux/1/L/y/K/1/poweroff.png) +Control Alt Delete Within Fedora. + +### 11. Power Off ### + +If you used to be a Windows user then you will remember the three finger salute known as CTRL, ALT and DELETE. + +If you press "CTRL", "ALT" and "DEL" on your keyboard within Fedora a message will appear telling you that your computer will shut down in 60 seconds. + +### 12. Editing Shortcuts ### + +The editing keyboard shortcuts are pretty much universal across every operating system. + +- CTRL + A Select All +- CTRL + X Cut +- CTRL + C Copy +- CTRL + V Paste +- CTRL + Z Undo + +### 13. Screen Capturing ### + +As with the editing shortcuts, the screencapturing keys are fairly standard + +- PRTSC (Print Screen) Take screenshot +- Alt + PRTSC Take screenshot of current window +- Shift + PRTSC Take screenshot of an area of the screen + +Here is one that is fairly unique but great for people making tutorial videos. + +- CTRL + ALT + SHIFT + R Record Screencast +- CTRL + ALT + SHIFT + R again Stop Screencast + +The [screencasts][4] will be stored in the videos folder under your home directory in the [webm][5] format. + +![Put Windows Side By Side.](http://f.tqn.com/y/linux/1/L/z/K/1/splitwindows.png) +Put Windows Side By Side. + +### 14. Put Windows Side By Side ### + +You can put windows side by side so that one uses up the left side of the screen and the other uses the right side of the screen. + +Press the "Super" and "Left Arrow" key on the keyboard to shift the current application to the left. + +Press the "Super" and "Right Arrow" key on the keyboard to shift the current application to the right. + +### 15. Maximise, Minimise And Restore Windows ### + +To maximise a window double click on the title bar. + +To restore a window to its original size double click on the maximised window. + +To minimise a window, right click and select "minimise" from the menu. + +![GNOME Keyboard Shortcut Cheat Sheet. ](http://f.tqn.com/y/linux/1/L/-/L/1/gnomekeyboardshortcuts.png) +GNOME Keyboard Shortcut Cheat Sheet. + +### 16. Summary ### + +To help you learn these keyboard shortcuts I have created a cheat sheet which you can print out and stick to your wall. + +When you have learned these shortcuts you will begin to appreciate how modern desktop environments work. + +- [Click here to view the Fedora Linux GNOME Desktop Environment cheat sheet.][6] +- [Click here for the GNOME WIKI][7] +- [The other GNOME WIKI][8] +- [An alternative GNOME 3 Cheat Sheet][9] + +-------------------------------------------------------------------------------- + +via: http://linux.about.com/od/howtos/tp/Fedora-GNOME-Keyboard-Shortcuts.htm + +作者:[Gary Newell][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linux.about.com/bio/Gary-Newell-132058.htm +[1]:https://www.gnome.org/gnome-3/ +[2]:http://en.wikipedia.org/wiki/Super_key_%28keyboard_button%29 +[3]:http://linux.about.com/library/gnome/blgnome2n4.htm +[4]:http://en.wikipedia.org/wiki/Screencast +[5]:http://en.wikipedia.org/wiki/WebM +[6]:https://s-media-cache-ak0.pinimg.com/originals/d5/f4/a4/d5f4a42c0940fae6653ee9a17294d450.jpg +[7]:http://en.wikipedia.org/wiki/GNOME +[8]:https://wiki.gnome.org/ +[9]:https://wiki.gnome.org/Gnome3CheatSheet \ No newline at end of file diff --git a/sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md b/sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md new file mode 100644 index 0000000000..0c01862bff --- /dev/null +++ b/sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md @@ -0,0 +1,144 @@ +How to share a directory with Samba on Fedora or CentOS +================================================================================ +Nowadays sharing data across different computers is not something new at home or many work places. Riding on this trend, modern operating systems make it easy to share and exchange data transparently across computers via network file systems. If your work environment involves a mix of Microsoft Windows and Linux computers, one way to share files and folders among them is via SMB/CIFS, a cross-platform network file sharing protocol. Windows Microsoft natively supports SMB/CIFS, while Linux offers free software implementation of SMB/CIFS network protocol in Samba. + +In this article, we will demonstrate **how to share a directory using Samba**. The Linux platform we will use is **Fedora or CentOS**. This article is dividied into four parts. First, we will install Samba under Fedora/CentOS environment. Next, we discuss how to adjust SELinux and firewall configurations to allow file sharing with Samba. Finally, we cover how to enable Samba to share a directory. + +### Step One: Install Samba on Fedora or CentOS ### + +First thing first. Let's install Samba and configure basic settings. + +Check whether Samba application is already installed on your system by running: + + $ rpm -q samba samba-common samba-client + +If the above command doesn't show anything at all, it means that Samba is not installed. In that case, install Samba using the command below. + + $ sudo yum install samba samba-common samba-client + +Next, creates a local directory which will share data over network. This directory will be exported to remote users as a Samba share. In this tutorial, we will create this directory in the top-level directory '/', so make sure that you have the privileges to do it. + + $ sudo mkdir /shared + +If you want to create a shared directory inside your home directory (e.g., ~/shared), you must activate Samba home directory sharing in the SELinux options, which will be described below in more detail. + +After creating /shared directory, set the privileges of the directory so other users can access it. + + $ sudo chmod o+rw /shared + +If you don't want other users to be able to have write to the directory, just remove the 'w' option in chmod command as follows. + + $ sudo chmod o+r /shared + +Next, create one empty file as a test. This file will be used to verify that he Samba share is mounted properly. + + $ sudo touch /shared/file1 + +### Step Two: Configure SELinux for Samba ### + +Next, we need to re-configure SELinux which is enabled by default in Fedora and CentOS distributions. SELinux allows Samba to read and modify files or directories only when they have the right security context (e.g., labeled with the 'samba_share_t' attribute). + +The following command adds the necessary label to file-context configuration: + + $ sudo semanage fcontext -a -t samba_share_t "(/.*)?" + +Replace the with the local directory we created earlier for Samba share (e.g., /shared): + + $ sudo semanage fcontext -a -t samba_share_t "/shared(/.*)?" + +To activate the label change, we then must run the restorecon command like below. + + $ sudo restorecon -R -v /shared + +![](https://farm9.staticflickr.com/8584/16652774078_2055f45f70_b.jpg) + +To share a directory inside our home directory via Samba, we must enable sharing home directory option in SELinux because it is disabled by default. The following command achieves the desired effect. Skip this step if you are not sharing your home directory. + + $ sudo setsebool -P samba_enable_home_dirs 1 + +### Step Three: Configure Firewall for Samba ### + +The next step is to open necessary TCP/UDP ports in the firewall settings for Samba to operate. + +If you are using firewalld (e.g., on Fedora or CentOS 7), the following command will take care of permanent firewall rule change for Samba service. + + $ sudo firewall-cmd --permanent --add-service=samba + +If you are using iptables for your firewall (e.g., CentOS 6 or earlier), use the following commands to open up necessary Samba ports to the world. + + $ sudo vi /etc/sysconfig/iptables + +---------- + + -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT + +Then restart iptables service: + + $ sudo service iptables restart + +### Step Four: Change Samba Configuration ### + +The last step is to configure Samba to export a created local directory as a Samba-share. + +Open the Samba configuration file with a text editor, and add the following lines at the bottom of the file. + + $ sudo nano /etc/samba/smb.conf + +---------- + + [myshare] + comment=my shared files + path=/shared + public=yes + writeable=yes + +In the above the text inside a pair of brackets (e.g., "myshare") is the name of the Samba-shared resource, which will be used to access the Samba share from a remote host. + +Create a Samba user account which is required to mount and export the Samba file system. To create a Samba user, use the smbpasswd tool. Note that the Samba user account must be the same as any existing Linux user. If you try to add a non-existing user with smbpasswd, it will give an error message. + +If you don't want to use any existing Linux user as a Samba user, you can create a new dedicated user in your system. For safety, set the new user's login shell to /sbin/nologin, and do not create its home directory. + +In this example, we are creating a new user named "sambaguest" as follows. + + $ sudo useradd -M -s /sbin/nologin sambaguest + $ sudo passwd sambaguest + +![](https://farm9.staticflickr.com/8702/16814479366_53f540d3ba_b.jpg) + +After creating a new user, add the user as a Samba user using smbpasswd command. When this command asks a password, you can type a different password than the user's password. + + $ sudo smbpasswd -a sambaguest + +4. Activate the Samba service, and check whether the Samba service is running or not. + + $ sudo systemctl enable smb.service + $ sudo systemctl start smb.service + $ sudo systemctl is-active smb + +![](https://farm8.staticflickr.com/7607/16652984770_622f24bccc_b.jpg) + +To see the list of shared directories in Samba, type the following command. + + $ smbclient -U sambaguest -L localhost + +![](https://farm8.staticflickr.com/7281/16220411103_06bf585901_b.jpg) + +The following is a screenshot of accessing the Samba-shared directory on Thunar file manager, and doing copy-paste of file1. Note that the Samba share is accessible via "smb:///myshare" address on Thunar. + +![](https://farm8.staticflickr.com/7644/16218011174_c8b34fcedc_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/share-directory-samba-fedora-centos.html + +作者:[Kristophorus Hadiono][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/kristophorus \ No newline at end of file