How to setup and deploy ssh keys under linux?

Not a hard working, and there are already many articles talk about that, but many students still don’t know how to do that …

The simple syntax for generating ssh key pair:
$ ssh-keygen -t algorithm -b bits -C "comments"

For example:
$ ssh-keygen -t rsa -b 4096 -C "my first ssh key pair!"

The simple syntax for deploying ssh key:
$ ssh-copy-id username@192.168.1.101

For example:
$ ssh-copy-id petex@192.168.1.101

If you also have problems with ssh keys, I will suggest you to read the articles below, they are confirmed by myself, I think those are correct and easy versions, and there is no need to write them in my blog again …

3 good articles should be enough …

Remotely shutdown/restart Windows via Linux on Debian/Ubuntu based Linux

Need samba-common package
sudo apt-get install samba-common

Then use this command to shutdown the computer remotely:
net rpc shutdown --ipaddress ip --user username%password

Add -r if you want to restart, not shutdown:
net rpc shutdown -r --ipaddress ip --user username%password

Success message:

Shutdown of remote machine succeeded

These messages mean failed:

  • Could not connect to server 192.168.1.55
  • Connection failed: NT_STATUS_IO_TIMEOUT
  • Connection failed: NT_STATUS_RESOURCE_NAME_NOT_FOUND
  • Could not initialise pipe winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND

There are many functions provide by net [rpc], like:

net rpc audit Modify global audit settings
net rpc info Show basic info about a domain
net rpc join Join a domain
net rpc oldjoin Join a domain created in server manager
net rpc testjoin Test that a join is valid
net rpc user List/modify users
net rpc password Change a user password
net rpc group List/modify groups
net rpc share List/modify shares
net rpc file List open files
net rpc printer List/modify printers
net rpc changetrustpw Change trust account password
net rpc trustdom Modify domain trusts
net rpc abortshutdown Abort a remote shutdown
net rpc shutdown Shutdown a remote server
net rpc samdump Dump SAM data of remote NT PDC
net rpc vampire Sync a remote NT PDC’s data into local passdb
net rpc getsid Fetch the domain sid into local secrets.tdb
net rpc rights Manage privileges assigned to SID
net rpc service Start/stop/query remote services
net rpc registry Manage registry hives
net rpc shell Open interactive shell on remote server
net rpc trust Manage trusts
net rpc conf Configure a remote samba server

Check man rpc for more detail!

Microsoft Visual Studio Code Preview and .NET core on Linux

當微軟也開始擁抱開放原始碼、自由軟體、Linux,身為資訊人是該有些省思。

.NET Core如微軟先前所說支援Linux了,甚至連FreeBSD的版本都有(開發中),而目前丟在GitHub上的版本可用的.NET Core API已經有全部的45%了,相信很快就能到八成以上,詳情可參考.NET blog:
.NET Announcements at Build 2015
http://blogs.msdn.com/b/dotnet/archive/2015/04/29/net-announcements-at-build-2015.aspx

另外一件大事是Microsoft Visual Studio CodeVisual Studio的 … 兄弟?或說是一個比較初期的opensource版本,據說是based on GitHubatom editor
看來以後需要寫程式的課終於可已有一統江湖的IDE了?

官網:
https://www.visualstudio.com/en-us/products/code-vs.aspx

MicrosoftVisualStudioCodePreviewWebsite2
MicrosoftVisualStudioCodePreviewWebsite我自己裝起來玩的畫面,期待可以變得跟我們認識的Visual Studio愈來愈像XD?
MicrosoftVisualStudioCodePreview

一些安裝完系統後要做的一些設定

ntp server:
現在比較少看到學校單位自己在架ntp server了,至於要設定ntp校時伺服器的原因,原因很簡單,系統上錯誤的時間會產生的問題不少,小則查log的時候讓時間參考依據降低、大則讓你失約、線上搶購搶不到、甚至連網站都不能上(因為SSL憑證是要看日期的),而ntp server設的不好結果就是時間誤差大、查詢費時、或查不到東西,之前有整理過列表,可以參考下面這篇 – 台灣合用的ntp server,Windows內建的設定是time.windows.com,就是屬於很不好用的那種 … 強烈建議換掉,在系統時間設定裡面有選項,參考話面如下:
windowsNtp

dns server:
公司企業或是學校單位基本上都還是會有自己的dns,若非品質或速度有嚴重問題,建議以local的為主就可以了,之前有做過測試,想要自己測試也可以參考這邊做法 – 用Google的Public DNS上網會變快?Google的DNS真的比較快嗎?之常用DNS測試,因為dns實際上花費時間還要加上query的時間,有些人直接用ping值來當作dns的速度參考其實不太恰當 … 另外之錢也整理過一些列表: – 台灣ISP常用DNS列表整理常用 Public DNS 清單整理 (IPv4)

Windows WSUS / Linux/FreeBSD mirror:
Linux或BSD的套件或source來源mirror是一定要的,不用多解釋 … 而Windows上也有一種機制叫做WSUS – Windows Server Update Services,在做的就是類似的事情,對於企業或是學校環境來講可以省下非常可觀的頻寬跟時間花費

Windows 系統還原停用:
很多人不知道Windows有這功能,知道也不太會用,如果是這樣不如把這功能關掉,因為在背景自動備份吃的資源不是很划算,而真的中毒或系統損毀通常靠這功能是救不回來的 …

至於系統更新還有Windows需要的方毒軟體應該不用多解釋了,剩下想到再補XD