2017年4月12日 星期三

RHEL-7.3 on AWS

Windows Putty 登入 RHEL-7.3 on AWS
https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/putty.html?icmpid=docs_ec2_console

切換 root
#sudo su -

安裝 KDE 

# yum groupinstall 'KDE'

參考:https://linuxconfig.org/installation-of-kde-desktop-manager-on-rhel-7-linux-server

安裝 XRDP

Step 1. Install EPEL and nux Desktop repository rpms by automatic. (recommended)
# yum localinstall http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

Step 2. The following command to install xrdp, and you will get the following output, make sure you are getting package from the newly created repository.
# yum -y install xrdp tigervnc-server

Step 3. Once it is installed, lets start the xrdp service.
# systemctl start xrdp.service

Step 4. The xrdp will listen on 3389, lets confirm this by issuing following command.
# netstat -antup | grep xrdp

Step 5. By default, services wont auto start after system reboot, issue the following command to enable the service at system start up.
# systemctl enable xrdp.service

Step 6. Next is to create iptables rule to allow rdp connection from the external machines, following command will add the exception for xrdp port (3389).(如果步驟 6 沒成功,先重開機再試)
# firewall-cmd --permanent --zone=public --add-port=3389/tcp
# firewall-cmd --reload

參考:http://blog.sina.com.tw/william_liao/article.php?entryid=661556

安裝  Chrome (root 登入 KDE)

安裝完成之後,你會發現在應用程序裡雙擊chrome沒有任何的反應,打開目錄 /usr/share/applications 右擊 Google Chrome 圖標點屬性,在命令這一行的最後輸入: --no-sandbox


Redhat 文件參考:https://access.redhat.com/documentation/zh_tw/red-hat-enterprise-linux/?version=pdf/

2017年3月23日 星期四

解除遠端登入解除一個使用者只能使用一個工作階段

解除遠端登入一個使用者只能使用一個工作階段
1.gpedit.msc 本機群組原則編輯器
電腦設定 > 系統管理範本 > Windows 元件 > 遠端桌面服務 > 遠端桌面工作階段主機 > 連線,(右邊視窗)限制遠端桌面服務的使用者只能使用一個遠端桌面服務工作階段,
預設為 " 尚未設定 " > 已停用 >確定

2.cmd
gpupdate

參考:https://chenweichi.blogspot.tw/2012/09/windows-server-2012_25.html

termsrv.dll 破解多人遠端限制其它:http://www.badbuta.com/2015/04/%E8%AE%93%E5%AE%B6%E4%B8%AD%E7%9A%84windows%E5%8F%AF%E4%BE%9B%E5%A4%9A%E4%BA%BA%E9%80%8F%E9%81%8E%E7%B6%B2%E7%B5%A1%E5%90%8C%E6%99%82%E4%BD%BF%E7%94%A8/

2017年3月9日 星期四

MySQL binlog (backup,archive,restore)

#my.ini 開啟 binlog,保留 7 天 (WAMP 2.5)
log-bin=L:\/
expire_logs_days = 7

#login root
mysql -u root -p
pcPxyncjC8hCbUn

#主機名稱
select @@hostname;
show variables where Variable_name like '%host%';

#目前連線
select host from information_schema.processlist;
show processlist;


#顯示檔名
show master status;
SHOW BINARY LOGS;

#binlog 參數
show variables like '%bin%';

#查看 binlog 内容
show binlog events;
show binlog events in '.000002';

#重播資料庫變動過程
mysqlbinlog hostname-bin.001

#還原 binlog
mysqlbinlog -H --set-charset="utf8" --start-datetime="2017-03-08 15:22:00" --stop-datetime="2017-03-09 10:00:00" L:\.000001 L:\.000002 > L:\binary.sql

#backup.bat(完整備份,清除 binlog)
set x=%date:~0,4%%date:~5,2%%date:~8,2%
mysqldump --flush-logs -u root -pLpcPxyncjC8hCbUn chair_flow > L:\backup%x%.sql

#http://forum.slime.com.tw/thread208729.html
#http://g9677602.blogspot.tw/2010/01/mysql-binary-log-mysql-bin-log.html
#https://blog.wu-boy.com/2007/03/mysql-mysqlbinlog-%E8%B3%87%E6%96%99%E5%BA%AB%E8%99%95%E7%90%86%E4%BA%8C%E9%80%B2%E5%88%B6%E6%97%A5%E8%AA%8C%E6%AA%94%E6%A1%88%E7%9A%84%E5%AF%A6%E7%94%A8%E5%B7%A5%E5%85%B7/

#取代欄位字串
UPDATE 表格
SET 欄位名稱 = REPLACE(欄位名稱, '123\', '')
WHERE ID = 4