Last active
          April 15, 2017 10:15 
        
      - 
      
 - 
        
Save sainu/fc5d850ad4fa1ea4b345a61a9126ffa1 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
Saino Katsutoshi revised this gist
Apr 15, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ for file in $files; do target_file_path=$target_dir_path/$file if [[ $file =~ '.pem' ]]; then chmod -h 400 $target_file_path elif [[ $file =~ '.pub' ]]; then chmod -h 644 $target_file_path elif [[ $file =~ 'config' ]]; then  - 
        
Saino Katsutoshi revised this gist
Apr 15, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ for file in $files; do target_file_path=$target_dir_path/$file if [[ $file =~ '.pem' ]]; then chmod -h 600 $target_file_path elif [[ $file =~ '.pub' ]]; then chmod -h 644 $target_file_path elif [[ $file =~ 'config' ]]; then  - 
        
Saino Katsutoshi created this gist
Apr 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ $ pwd /path/to/Dropbox/.ssh $ tree . . ├── config ├── id_hoge_rsa ├── id_hoge_rsa.pub └── hoge.pem This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ $ pwd /path/to/Dropbox/.ssh $ touch setup.sh $ chmod 755 setup.sh $ vim setup.sh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ $ pwd /path/to/Dropbox/.ssh $ ./setup.sh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ $ cd ~/.ssh $ ls -la lrw-r--r-- 1 me staff 42 4 15 18:24 config@ -> /path/to/Dropbox/.ssh/config $ vim config Host hogehoge ...(中略)... This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/bin/sh files=`find . -maxdepth 1 -type f | sed "s!^.*/!!" | grep -vE "setup.sh|.DS_Store"` for file in $files; do file_path=`pwd`/$file target_dir_path=$HOME/.ssh/ ln -s $file_path $target_dir_path target_file_path=$target_dir_path/$file if [[ $file =~ '.pem' ]]; then chmod -h 400 $target_file_path elif [[ $file =~ '.pub' ]]; then chmod -h 644 $target_file_path elif [[ $file =~ 'config' ]]; then chmod -h 644 $target_file_path else chmod -h 600 $target_file_path fi done