This commit is contained in:
yupmoon 2014-12-16 16:56:25 +08:00
commit 0a65b81754
4 changed files with 342 additions and 345 deletions

View File

@ -1,239 +0,0 @@
Translating by ZTinoZ
10 SCP Commands to Transfer Files/Folders in Linux
================================================================================
Linux administrator should be familiar with **CLI** environment. Since **GUI** mode in Linux servers is not a common to be installed. **SSH** may the most popular protocol to enable Linux administrator to manage the servers via remote in secure way. Built-in with **SSH** command there is **SCP** command. **SCP** is used to copy file(s) between servers in secure way.
![](http://www.tecmint.com/wp-content/uploads/2013/10/SCP-Commands.png)
The below command will read as “**copy source_file_name**” into “**destination_folder**” at “**destination_host**” using “**username account**”.
#### Basic syntax of SCP ####
scp source_file_name username@destination_host:destination_folder
There are much parameters in **SCP** command that you can use. Here are the parameters that may useful on daily basis usage.
### Provide the detail information of SCP process using -v parameter ###
Basic **SCP** command without parameter will copy the files in background. User will see nothing unless the process is done or some error appears. You can use “**-v**” parameter to print debug information into the screen. It can help you debugging connection, authentication and configuration problems.
pungki@mint ~/Documents $ scp -v Label.pdf mrarianto@202.x.x.x:.
#### Sample Output ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
Sending file modes: C0770 3760348 Label.pdf
Sink: C0770 3760348 Label.pdf
Label.pdf 100% 3672KB 136.0KB/s 00:27
Transferred: sent 3766304, received 3000 bytes, in 65.2 seconds
Bytes per second: sent 57766.4, received 46.0
debug1: Exit status 0
### Provide modification times, access times, and modes from original files ###
The “**-p**” parameter will help you on this. An estimated time and the connection speed will appear on the screen.
pungki@mint ~/Documents $ scp -p Label.pdf mrarianto@202.x.x.x:.
#### Sample Output ####
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 126.6KB/s 00:29
### Make file transfer faster using -C parameter ###
One of parameter that can faster your file transfer is “**-C**” parameter. The “**-C**” parameter will compress your files on the go. The unique thing is the compression is only happen in the network. When the file is arrived to the destination server, it will returning into the original size as before the compression happen.
Take a look of these commands. It is using a single file of **93 Mb**.
pungki@mint ~/Documents $ scp -pv messages.log mrarianto@202.x.x.x:.
#### Sample Output ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380425711
Sending file timestamps: T1323853868 0 1380425711 0
messages.log 100% 93MB 58.6KB/s 27:05
Transferred: sent 97614832, received 25976 bytes, in 1661.3 seconds
Bytes per second: sent 58758.4, received 15.6
debug1: Exit status 0
Copying file without “**-C**” parameter will result **1661.3** second. Yo may compare the result to the command below which using “**-C**” parameter.
pungki@mint ~/Documents $ scp -Cpv messages.log mrarianto@202.x.x.x:.
#### Sample Output ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: channel 0: new [client-session]
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380428748
Sending file timestamps: T1323853868 0 1380428748 0
Sink: T1323853868 0 1380428748 0
Sending file modes: C0600 97517300 messages.log
messages.log 100% 93MB 602.7KB/s 02:38
Transferred: sent 8905840, received 15768 bytes, in 162.5 seconds
Bytes per second: sent 54813.9, received 97.0
debug1: Exit status 0
debug1: compress outgoing: raw data 97571111, compressed 8806191, factor 0.09
debug1: compress incoming: raw data 7885, compressed 3821, factor 0.48
As you can see, when you are using compression, transfer process is done in **162.5** second. It is **10** times faster than not using “**-C**” parameter. If you are copying a lot files across the network, “**-C**” parameter would help you to decrease the total time you need.
The thing that we should notice that compression method will not work on any files. When the source file is already compressed, you will not find any improvement there. Files such as **.zip**, **.rar**, **pictures**, and **.iso** files will not affected by “**-C**” parameter.
### Select another cipher to encrypt files ###
By default **SCP** using “**AES-128**” to encrypt files. If you want to change to another cipher to encrypt it, you can use “**-c**” parameter. Take a look of this command.
pungki@mint ~/Documents $ scp -c 3des Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
Above command tell **SCP** to use **3des algorithm** to encrypt file. Please be careful that this parameter using “**-c**” not “**-C**“.
### Limiting bandwidth usage ###
Another parameter that may useful is “**-l**” parameter. The “**-l**” parameter will limit the bandwidth to use. It will be useful if you do an automation script to copy a lot of file, but you dont want the bandwidth is drained by the **SCP** process.
pungki@mint ~/Documents $ scp -l 400 Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 50.3KB/s 01:13
The **400** value behind “**-l**” parameter is mean that we limit the bandwidth for **SCP** process only **50 KB/sec**. One thing to remember that bandwidth is specified in **Kilobits/sec** (**kbps**). It is mean that **8 bits** equal with **1 byte**.
While **SCP** counts in **Kilobyte/sec** (**KB/s**). So if you want to limit your bandwidth for **SCP** maximum only **50 KB/s**, you need to set it into **50 x 8 = 400**.
### Specify specific port to use with SCP ###
Usually **SCP** is using port **22** as a default port. But for security reason, you may change the port into another port. For example, we are using port **2249**. Then the command should be like this.
pungki@mint ~/Documents $ scp -P 2249 Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 262.3KB/s 00:14
Make sure that it use capital “**P**” not “**p**“, since “**p**” is already used for preserved times and modes.
### Copy files inside directory recursively ###
Sometimes we need to copy directory and all **files** / **directories** inside it. It will be better if we can do it in **1** command. **SCP** support that scenario using “**-r**” parameter.
pungki@mint ~/Documents $ scp -r documents mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
scp.txt 100% 10KB 9.8KB/s 00:00
When the copy process is done, at the destination server you will found a directory named “**documents**” with all its files. The folder “**documents**” is automatically created.
### Disable progress meter and warning / diagnostic message ###
If you choose not to see progress meter and warning / diagnostic messages from SCP, you may disable it using “**-q**” parameter. Heres the example.
pungki@mint ~/Documents $ scp -q Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
pungki@mint ~/Documents $
As you can see, after the you enter the password, there is no any information about SCP process. After the process is complete, you will be see a prompt again.
### Copy files using SCP through Proxy ###
Proxy server is usually used in office environment. Natively, SCP is not proxy configured. When your environment using proxy, you have to “tell” SCP to communicate with the proxy.
Heres the scenario. The proxy address is **10.0.96.6** and the proxy port is **8080**. The proxy also implemented user authentication. First, you need to create “**~/.ssh/config**” file. Second you put this command inside it.
ProxyCommand /usr/bin/corkscrew 10.0.96.6 8080 %h %p ~/.ssh/proxyauth
Then you need to create file “**~/.ssh/proxyauth**” which contain.
myusername:mypassword
After that you can do SCP transparently as usual.
Please notice that corkscrew is might not installed yet on your system. On my Linux Mint, I need to install it first, using standard Linux Mint installation procedure.
$ apt-get install corkscrew
For other yum based systems, users can install corkscrew using the following yum command.
# yum install corkscrew
Another thing that since “**~/.ssh/proxyauth**” file contain your “**username**” and “**password**” in clear-text format, please make sure that the file can be accessed by you only.
### Select different ssh_config file ###
For mobile user who often switch between company network and public network, it will be suffer to always change settings in SCP. It is better if we can put a different **ssh_config** file to match our needs.
#### Heres a sample scenario ####
Proxy is used in company network but not in public network and you are regularly switch network.
pungki@mint ~/Documents $ scp -F /home/pungki/proxy_ssh_config Label.pdf
mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
By default “**ssh_config**” file per user will be placed in “**~/.ssh/config**“. Creating a specific “**ssh_config**” file with proxy compatible, will make you easier to switch between networks.
When you are on company network, you can use “**-F**” parameter. When you are on public network, you can skip “**-F**” parameter.
Thats all about **SCP**. You can see **man pages** of **SCP** for more detail. Please feel free to leave comments and suggestions.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/scp-commands-examples/
作者:[Pungki Arianto][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/pungkiarianto/

View File

@ -1,106 +0,0 @@
Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server
================================================================================
Jetty provides a Web server and javax.servlet container, plus support for SPDY, WebSocket, OSGi, JMX, JNDI, JAAS and many other integrations. These components are open source and available for commercial use and distribution.
Jetty is used in a wide variety of projects and products, both in development and production. Jetty can be easily embedded in devices, tools, frameworks, application servers, and clusters. See the Jetty Powered page for more uses of Jetty.
### Jetty Features ###
- Full-featured and standards-based
- Open source and commercially usable
- Flexible and extensible
- Small footprint
- Embeddable
- Asynchronous
- Enterprise scalable
- Dual licensed under Apache and Eclipse
### Install Jetty9 on ubuntu 14.10 server ###
#### Prerequisites ####
You need to install Java before installing jetty server using the following command
sudo apt-get install openjdk-8-jdk
This will install it to /usr/lib/jvm/java-8-openjdk-i386. A symlink java-1.8.0-openjdk-i386 is created in the directory /usr/lib/jvm/. A symlink is also created at /usr/bin/java
Now you need to download Jetty9 from [here][1] after downloading you need to extract using the following command
$tar -xvf jetty-distribution-9.2.5.v20141112.tar.gz
This unpacks the jetty-distribution-9.2.5.v20141112 and you need to Move the archive to /opt/jetty using the following command
$mv jetty-distribution-9.2.5.v20141112 /opt/jetty
You need to Create jetty user and make it the owner of /opt/jetty directory
sudo useradd jetty -U -s /bin/false
sudo chown -R jetty:jetty /opt/jetty
#### Jetty Startup Script ####
Copy the Jetty script to run as a service using the following command
$ cp /opt/jetty/bin/jetty.sh /etc/init.d/jetty
Now you need to create jetty settings file with the following content
sudo vi /etc/default/jetty
Add the following lines
JAVA_HOME=/usr/bin/java
JETTY_HOME=/opt/jetty
NO_START=0
JETTY_ARGS=jetty.port=8085
JETTY_HOST=0.0.0.0
JETTY_USER=jetty
Save and exit the file
You need to start jetty service using the following command
sudo service jetty start
You should see output similar to the following
Starting Jetty: OK Mon Nov 24 11:55:48 GMT 2014
If you see the following error
#### ** ERROR: JETTY_HOME not set, you need to set it or install in a standard location ####
You need to make sure you have correct jetty home path in /etc/default/jetty file i.e JETTY_HOME=/opt/jetty
You can test the jetty using the following URL
It should now be running on port 8085! Visit in your browser http://serverip:8085 and you should see a Jetty screen.
#### Jetty Service checking ####
Verify and check your configuration with the following command
sudo service jetty check
Jetty automatically start on reboot using the following command
sudo update-rc.d jetty defaults
Reboot the server and test if Jetty starts automatically.
To check which port Jetty is running or whether there are any conflicts with other programs for that port, run netstat -tln
--------------------------------------------------------------------------------
via: http://www.ubuntugeek.com/install-jetty-9-java-servlet-engine-and-webserver-on-ubuntu-14-10-server.html
作者:[ruchi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.ubuntugeek.com/author/ubuntufix
[1]:http://download.eclipse.org/jetty/stable-9/dist/

View File

@ -0,0 +1,238 @@
Linux的十条SCP传输命令
================================================================================
Linux系统管理员应该很熟悉**CLI**环境因为在Linux服务器中是不安装**GUI**的。**SSH**可能是Linux系统管理员通过远程方式安全管理服务器的最流行协议。在**SSH**命令中内置了一种叫**SCP**的命令,用来在服务器之间安全传输文件。
![](http://www.tecmint.com/wp-content/uploads/2013/10/SCP-Commands.png)
以下命令可以解读为:用“**username account**”“**拷贝 source file name**”到“**destination host**”上的“**destination folder**”里。
#### SCP命令的基本语法 ####
scp source_file_name username@destination_host:destination_folder
**SCP**命令有很多参数供你使用,这里指的是每次都会用到的参数。
### 用-v参数来提供SCP进程的详细信息 ###
不带参数的基本**SCP**命令会在后台拷贝文件,除非操作完成或者有错误出现,否则用户在界面上是看不到任何提示信息的。你可以用“**-v**”参数来在屏幕上打印出调试信息,这能帮助你调试连接、认证和配置的一些问题。
pungki@mint ~/Documents $ scp -v Label.pdf mrarianto@202.x.x.x:.
#### 部分输出 ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
Sending file modes: C0770 3760348 Label.pdf
Sink: C0770 3760348 Label.pdf
Label.pdf 100% 3672KB 136.0KB/s 00:27
Transferred: sent 3766304, received 3000 bytes, in 65.2 seconds
Bytes per second: sent 57766.4, received 46.0
debug1: Exit status 0
### 从源文件获取修改时间、访问时间和模式 ###
“**-p**”参数会帮到把预计的时间和连接速度会显示在屏幕上。
pungki@mint ~/Documents $ scp -p Label.pdf mrarianto@202.x.x.x:.
#### 部分输出 ####
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 126.6KB/s 00:29
### 用-C参数来让文件传输更快 ###
有一个参数能让传输文件更快,就是“**-C**”参数,它的作用是不停压缩所传输的文件。它特别之处在于压缩是在网络中进行,当文件传到目标服务器时,它会变回压缩之前的原始大小。
来看看这些命令,我们使用一个**93 Mb**的单一文件来做例子。
pungki@mint ~/Documents $ scp -pv messages.log mrarianto@202.x.x.x:.
#### 部分输出 ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380425711
Sending file timestamps: T1323853868 0 1380425711 0
messages.log 100% 93MB 58.6KB/s 27:05
Transferred: sent 97614832, received 25976 bytes, in 1661.3 seconds
Bytes per second: sent 58758.4, received 15.6
debug1: Exit status 0
不用“**-C**”参数来拷贝文件,结果用了**1661.3**秒,你可以比较下用了“**-C**”参数之后的结果。
pungki@mint ~/Documents $ scp -Cpv messages.log mrarianto@202.x.x.x:.
#### 部分输出 ####
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
mrarianto@202.x.x.x's password:
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: channel 0: new [client-session]
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380428748
Sending file timestamps: T1323853868 0 1380428748 0
Sink: T1323853868 0 1380428748 0
Sending file modes: C0600 97517300 messages.log
messages.log 100% 93MB 602.7KB/s 02:38
Transferred: sent 8905840, received 15768 bytes, in 162.5 seconds
Bytes per second: sent 54813.9, received 97.0
debug1: Exit status 0
debug1: compress outgoing: raw data 97571111, compressed 8806191, factor 0.09
debug1: compress incoming: raw data 7885, compressed 3821, factor 0.48
看到了吧,压缩了文件之后,传输过程在**162.5**秒内就完成了,速度是不用“**-C**”参数的10倍。如果你要通过网络拷贝很多份文件那么“**-C**”参数能帮你节省掉很多时间。
有一点我们需要注意,这个压缩的方法不是适用于所有文件。当源文件已经被压缩过了,那就没办法再压缩了。诸如那些像**.zip****.rar****pictures**和**.iso**的文件,用“**-C**”参数就无效。
### 选择其它加密算法来加密文件 ###
**SCP**默认是用“**AES-128**”加密算法来加密文件的。如果你想要改用其它加密算法来加密文件,你可以用“**-c**”参数。我们来瞧瞧。
pungki@mint ~/Documents $ scp -c 3des Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
上述命令是告诉**SCP**用**3des algorithm**来加密文件。要注意这个参数是“**-c**”而不是“**-C**“。
### 限制带宽使用 ###
还有一个很有用的参数是“**-l**”参数,它能限制使用带宽。如果你为了拷贝很多文件而去执行了一份自动化脚本又不希望带宽被**SCP**进程耗尽,那这个参数会非常管用。
pungki@mint ~/Documents $ scp -l 400 Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 50.3KB/s 01:13
在“**-l**”参数后面的这个**400**值意思是我们给**SCP**进程限制了带宽为**50 KB/秒**。有一点要记住,带宽是以**千比特/秒** (**kbps**)表示的,**8 比特**等于**1 字节**。
因为**SCP**是用**千字节/秒** (**KB/s**)计算的,所以如果你想要限制**SCP**的最大带宽只有**50 KB/s**,你就需要设置成**50 x 8 = 400**。
### 指定端口 ###
通常**SCP**是把**22**作为默认端口。但是为了安全起见,你可以改成其它端口。比如说,我们想用**2249**端口,命令如下所示。
pungki@mint ~/Documents $ scp -P 2249 Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 262.3KB/s 00:14
确认一下写的是大写字母“**P**”而不是“**p**“,因为“**p**”已经被用来保留源文件的修改时间和模式。
### 递归拷贝文件和文件夹 ###
有时我们需要拷贝文件夹及其内部的所有**文件** / **文件夹**,我们如果能用一条命令解决问题那就更好了。**SCP**用“**-r**”参数就能做到。
pungki@mint ~/Documents $ scp -r documents mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
scp.txt 100% 10KB 9.8KB/s 00:00
拷贝完成后,你会在目标服务器中找到一个名为“**documents**”的文件夹,其中就是所拷贝的所有文件。“**documents**”是系统自动创建的文件夹。
### 禁用进度条和警告/诊断信息 ###
如果你不想从SCP中看到进度条和警告/诊断信息,你可以用“**-q**”参数来禁用它们,举例如下。
pungki@mint ~/Documents $ scp -q Label.pdf mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
pungki@mint ~/Documents $
正如你所看到的在你输入密码之后没有任何关于SCP进度的消息反馈。进度完成后你也看不到任何提示。
### 用SCP通过代理来拷贝文件 ###
代理服务器经常用于办公环境SCP自然是没有经过代理方面的配置的。当你的环境正在使用代理那么你就必须要“告诉”SCP与代理关联起来。
场景如下:代理的地址是**10.0.96.6**端口是8080。该代理还实现了用户认证功能。首先你需要创建一个“**~/.ssh/config**”文件,其次把以下命令输入进该文件。
ProxyCommand /usr/bin/corkscrew 10.0.96.6 8080 %h %p ~/.ssh/proxyauth
接着你需要创建一个同样包括以下命令的“**~/.ssh/proxyauth**”文件。
myusername:mypassword
然后你就可以像往常一样使用SCP了。
请注意corkscrew可能还没有安装在你的系统中。在我的Linux Mint中我需要首先先用标准Linux Mint安装程序来安装它。
$ apt-get install corkscrew
对于其它的一些基于yum安装的系统用户能用以下的命令来安装corkscrew。
# yum install corkscrew
还有一点就是因为“**~/.ssh/proxyauth**”文件中以明文的格式包含了你的“**用户名**”和“**密码**”,所以请确保该文件只能你来查看。
### 选择不同的ssh_config文件 ###
对于经常在公司网络和公共网络之间切换的移动用户来说一直改变SCP的设置显然是很痛苦的。如果我们能放一个不同的**ssh_config**文件来匹配我们的需求那就很好了。
#### 以下是一个简单的场景 ####
代理是被用来在公司网络但不是公共网络并且你会定期切换网络时候使用的。
pungki@mint ~/Documents $ scp -F /home/pungki/proxy_ssh_config Label.pdf
mrarianto@202.x.x.x:.
mrarianto@202.x.x.x's password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
默认情况下每个用户会把“**ssh_config**”文件放在“**~/.ssh/config**“路径下。用兼容的代理创建一个特定的“**ssh_config**”文件,能让你切换网络时更加方便容易。
当你处于公司网络时,你可以用“**-F**”参数,当你处于公共网络时,你可以忽略掉“**-F**”参数。
以上就是关于**SCP**的全部内容了,你可以查看**SCP**的**man页面**来获取更多内容,请随意留下您的评论及建议。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/scp-commands-examples/
作者:[Pungki Arianto][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/pungkiarianto/

View File

@ -0,0 +1,104 @@
Ubuntu 14.10 Server上安装Jetty 9Java服务引擎和Web服务器
================================================================================
Jetty提供了一个Web服务器和javax.servlet容器为SPDY、WebSocket、OSGi、JMX、JNDI、JAAS以及许多其它集成套件添加了支持。这些组件都是开源的也可用于商业用途和分发。
Jetty被广泛用于多种项目和产品都可以在开发环境和生产环境中使用。Jetty可以很容易地嵌入到设备、工具、框架、应用服务器以及集群中。更多用途可参见Jetty网页。
### Jetty特性 ###
- 全功能并基于标准
- 开源与商用两可
- 灵活和可扩展
- 小足迹
- 可嵌入
- 异步
- 企业弹性扩展
- Apache和Eclipse双重许可
### ubuntu 14.10 server上安装Jetty 9 ###
#### 先决条件 ####
在安装Jetty服务器前您需要通过以下命令安装Java
sudo apt-get install openjdk-8-jdk
Java将会安装到/usr/lib/jvm/java-8-openjdk-i386同时在该目录下会创建一个名为java-8-openjdk-i386的符号链接在/usr/bin/java下也会相应创建符号链接。
现在你需要从[这里][1]下载Jetty9在下载完成后你需要使用以下命令来解压缩
$tar -xvf jetty-distribution-9.2.5.v20141112.tar.gz
该操作会将它解压到jetty-distribution-9.2.5.v20141112而你需要使用以下命令将归档文件移动到/opt/jetty
$mv jetty-distribution-9.2.5.v20141112 /opt/jetty
你需要创建jetty用户并将其设置成/opt/jetty目录的属主
sudo useradd jetty -U -s /bin/false
sudo chown -R jetty:jetty /opt/jetty
使用以下命令拷贝Jetty脚本到启动目录以便让它作为一个服务来运行
$ cp /opt/jetty/bin/jetty.sh /etc/init.d/jetty
现在你需要使用以下内容来创建Jetty设置文件
sudo vi /etc/default/jetty
添加以下行
JAVA_HOME=/usr/bin/java
JETTY_HOME=/opt/jetty
NO_START=0
JETTY_ARGS=jetty.port=8085
JETTY_HOST=0.0.0.0
JETTY_USER=jetty
保存并退出该文件
你需要使用以下命令来启动Jetty服务
sudo service jetty start
你应该看到和下面类似的输出
Starting Jetty: OK Mon Nov 24 11:55:48 GMT 2014
如果你看到了下面的错误
#### ** ERROR: JETTY_HOME not set, you need to set it or install in a standard location ####
你需要确保在/etc/default/jetty文件中设置了正确的Jetty家目录路径
你可以使用以下URL来测试jetty
Jetty现在应该运行在8085端口打开浏览器并访问http://serverip:8085你应该可以看到Jetty屏幕。
#### Jetty服务检查 ####
使用以下命令来验证并检查配置
sudo service jetty check
使用以下命令来让Jetty开重启后自动启动
sudo update-rc.d jetty defaults
重启服务器并测试Jetty是否自动启动。
要检查Jetty运行在哪个端口上或者该端口是否与其它程序冲突可以运行netstat -tln
--------------------------------------------------------------------------------
via: http://www.ubuntugeek.com/install-jetty-9-java-servlet-engine-and-webserver-on-ubuntu-14-10-server.html
作者:[ruchi][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.ubuntugeek.com/author/ubuntufix
[1]:http://download.eclipse.org/jetty/stable-9/dist/