Skip to content

Commit

Permalink
Merge pull request #7 from CMIPT/develop
Browse files Browse the repository at this point in the history
Bump up version to v0.1.4
  • Loading branch information
Kaiser-Yang authored Jul 31, 2024
2 parents 934e238 + dac6fc9 commit 7f34026
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 CMIPT

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[中文版本](README-zh.md)

# Release Log
## Release-v0.1.4
* Add a script creating ssh-copy-id for Windows
* Add an MIT license

## Release-v0.1.3
* Fix typos
* Add `sudo` before the `docker update --restart=always` command
Expand Down Expand Up @@ -140,7 +144,7 @@ Let me show you an example creating a user named `kaiser` (note that you should

1. Let us first connect to the server.

Open your terminal (choose whatever the shell you like, in `Windows` it is `cmd` or `powershell`, and in `unix-like` system it is `bash`)
Open your terminal, and then choose whatever the shell you like, in `Windows` it is `cmd` or `powershell`. It is worth noting that `cmd` is not recommended, `powershell` is recommended, and if you have a `gitbash`, `gitbash` is strongly recommended. In `unix-like` system it is `bash`.

Connect to your docker using this `ssh -p port root@address`, and the `port` and `address` are those the server manager have told you. Input your password (the password the manager have told you). Once it is correct, you will enter your docker (usually in `bash`).

Expand All @@ -166,10 +170,24 @@ Let me show you an example creating a user named `kaiser` (note that you should

If you don't have a ssh key, you may need create a new one. This command will help you: `ssh-keygen`. For simple way, you just need press enter key when it requires your confirm. If you already have one, just use the one you have created before.

Now you already have a ssh key, use this command to upload your ssh key to the docker for user `kaiser`: `ssh-copy-id -p port kaiser@address`, the `port` and the `address` are same with the before ones. Then you just need input the password of `kaiser`.
Now you already have a ssh key, use this command to upload your ssh key to the docker for user `kaiser`: `ssh-copy-id -p port kaiser@address`, the `port` and the `address` are same with the before ones. Then you just need input the password of `kaiser`. Note that in `Windows`, there is not a built-in `ssh-copy-id` command. But don't worry, I've found a script that defines a function called `ssh-copy-id`. Copy the code below into your `powershell` (`cmd` does not support this, if you are using `git bash`, `ssh-copy-id` is available). Then press enter key, after this, you can use `ssh-copy-id` in this shell. Then re-run the command `ssh-copy-id -p port kaiser@address`.

If there is no any error, congratulations, you have done. But you have to do some more to make your login more convenient.

The script for creating a function called `ssh-copy-id` for `powershell`:

```bash
function ssh-copy-id([string]$userAtMachine, $args){
$publicKey = "$ENV:USERPROFILE" + "/.ssh/id_rsa.pub"
if (!(Test-Path "$publicKey")){
Write-Error "ERROR: failed to open ID file '$publicKey': No such file"
}
else {
& cat "$publicKey" | ssh $args $userAtMachine "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys || exit 1"
}
}
```
5. Let us do something more to make login with `ssh labserver` possible.
Now you can use `ssh -p port kaiser@address` to login your docker without inputting any password. This is OK, but every time you must enter `-p port kaiser@address` this is inconvenient.
Expand Down

0 comments on commit 7f34026

Please sign in to comment.