2020年7月29日 星期三

Debian apt 使用 proxy 更新

編輯 /etc/apt/apt.conf
Acquire::http::Proxy "http://proxy.tw:8080";

Debian 10 設定 /etc/rc.local

1.編輯 /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

2.編輯 /etc/rc.local

#!/bin/bash

exit 0;

3.chmod a+x /etc/rc.local

4.systemctl enable rc-local
 

5.systemctl start rc-local

2020年7月28日 星期二

Debian 10.4 安裝 R Studio server 摘要

sudo apt-get install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.1093-amd64.deb
sudo gdebi rstudio-server-1.3.1093-amd64.deb

Debian 10.4 安裝 R 摘要

apt install dirmngr --install-recommends
apt install software-properties-common
apt install apt-transport-https
apt update
apt upgrade -y
apt install r-base

親屬關係分析工具-KING 安裝摘要

KING

# install KING version 2.2.5 (released on June 5, 2020).
# http://people.virginia.edu/~wc9c/KING/Download.htm

src=http://people.virginia.edu/~wc9c/KING/Linux-king.tar.gz
target=/opt/KING2.2.5

[ $(which busybox) ]&& { for i in wget;do [ -f "/usr/local/bin/${i}" ] || ln -s $(which busybox) /usr/local/bin/${i}; done; };
for i in wget;do [ $(which ${i}) ]&& : || { echo check ${i}: not found ${i}! &&exit 1; } ;done;
[ -d "$target" ]&&mv ${target} ${target}.$(date +%Y-%m-%d-%H-%M);
mkdir -p $target;cd $target;
echo $target >readme.txt;echo $src >>readme.txt
wget -q -O- http://people.virginia.edu/~wc9c/KING/Linux-king.tar.gz|tar zxf -;
chmod a+x king;cd -;
for i in king;do [ -f "/usr/local/bin/${i}" ]&&mv /usr/local/bin/${i} /usr/local/bin/${i}.$(date +%Y-%m-%d-%H-%M); ln -s ${target}/${i} /usr/local/bin/${i};done;


GWAS工具-Haploview安裝摘要

Haploview

https://www.broadinstitute.org/haploview/downloads

apt install -y openjdk-11-jre*
wget -q -O /opt/Haploview.jar https://www.broadinstitute.org/ftp/pub/mpg/haploview/Haploview.jar

echo "java -jar /opt/Haploview.jar &" >/usr/local/bin/haploview
chmod a+x /usr/local/bin/haploview

GWAS 分析工具-plink 安裝摘要

# install PLINK 1.07
# http://zzz.bwh.harvard.edu//plink/download.shtml#download

src=http://zzz.bwh.harvard.edu//plink/dist/plink-1.07-x86_64.zip
target=/opt/PLINK1.07

[ $(which busybox) ]&& { for i in wget unzip;do [ -f "/usr/local/bin/${i}" ] || ln -s $(which busybox) /usr/local/bin/${i}; done; };
for i in unzip wget;do [ $(which ${i}) ]&& : || { echo check ${i}: not found ${i}! &&exit 1; } ;done;
[ -d "$target" ]&&mv ${target} ${target}.$(date +%Y-%m-%d-%H-%M);
mkdir -p $target;cd $target;
echo $target >readme.txt;echo $src >>readme.txt
wget -q -O- $src | unzip -;
mv ${target}/plink-1.07-x86_64/* ${target}/
chmod a+x ${target}/plink;
rmdir ${target}/plink-1.07-x86_64;


# install PLINK 1.90beta
# https://www.cog-genomics.org/plink/1.9/

src=http://s3.amazonaws.com/plink1-assets/dev/plink_linux_x86_64.zip
target=/opt/PLINK1.90beta

[ $(which busybox) ]&& { for i in wget unzip;do [ -f "/usr/local/bin/${i}" ] || ln -s $(which busybox) /usr/local/bin/${i}; done; };
for i in unzip wget;do [ $(which ${i}) ]&& : || { echo check ${i}: not found ${i}! &&exit 1; } ;done;
[ -d "$target" ]&&mv ${target} ${target}.$(date +%Y-%m-%d-%H-%M);
mkdir -p $target;cd $target;
echo $target >readme.txt;echo $src >>readme.txt
wget -q -O- $src | unzip -;
chmod a+x plink prettify;cd -;
for i in plink prettify;do [ -f "/usr/local/bin/${i}" ]&&mv /usr/local/bin/${i} /usr/local/bin/${i}.$(date +%Y-%m-%d-%H-%M);   ln -s ${target}/${i} /usr/local/bin/${i};done;

xrdp client 資源限制

編輯 /etc/xrdp/xrdp.ini

rdpdr=[true|false]  設備轉向
    If set to 1, true or yes using the RDP channel for device redirection is allowed.

rdpsnd=[true|false] 聲音功能
    If set to 1, true or yes using the RDP channel for sound is allowed.

drdynvc=[true|false]  初始化附加動態 channel 
    If set to 1, true or yes using the RDP channel to initiate additional dynamic virtual channels is allowed.

cliprdr=[true|false] 
    If set to 1, true or yes using the RDP channel for clipboard redirection is allowed.

rail=[true|false]
    If set to 1, true or yes using the RDP channel for remote applications integrated locally (RAIL) is allowed.

xrdpvr=[true|false] 視訊流功能
    If set to 1, true or yes using the RDP channel for XRDP Video streaming is allowed.


2020年7月27日 星期一

Debian 10.4安裝browser chrome

apt install -y  fonts-liberation  libappindicator3-1
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

proxy 設定方法
指令列加上  --proxy-server="IP proxy Server:port"

scim 無法正確執行

編輯 /etc/X11/Xsession.d/74scim

export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE=SCIM
export QT_IM_MODULE=SCIM
export XIMPROGRAM="scim -d"
scim -d

2020年7月21日 星期二

限制 Windows RDS 遠端主機和本機資源

RDS上
本機群組原則編輯器 (gpedit)
本機電腦原則-電腦設定-系統管理範本-Windows元件-遠端桌面服務-遠端桌面工作階段主機

AD上
本機群組原則編輯器 (gpedit)
本機電腦原則-電腦設定-系統管理範本-Windows元件-遠端桌面服務-遠端桌面工作階段主機-裝置及資源重新導向

Windows2K3
Administrative Templates > Windows Components > Terminal Services > Client/Server data redirection: Do not allow Clipboard redirection - enabled

Windows AD 查詢帳號登入資訊,包含密碼上次變更時間

net user  administrator
net user  administrator /domain

變更密碼指令
net user administrator new-password
net user administrator new-password /domain

2020年7月18日 星期六

windows eerver 2003 install Certificate Services

1.新增或移除Windows元件-Certificate Services

2.Request a new server certificate for LDAP server
Open Certificates mmc:
Start - Run - mmc
File - Add/Remove Snap-in
Add - Certificates - Computer Account - Local Computer
Request certificate
Certificates > Personal - Certificates
Actions - All Tasks- Request New Certificate
Complete wizard with default values.

sssd 除錯

1.Couldn't authenticate to active directory: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS
編輯 /etc/krb5.conf
[libdefaults]
rdns = false

2.無法正確查詢
編輯 /etc/krb5.conf
[libdefaults]
default_realm = DOMAIN.NAME

2020年7月17日 星期五

2020年7月15日 星期三

windows server 2003 + sssd + xrdp 除錯摘要

1.sp2

2. /etc/X11/Xwrapper.config containing
allowed_users = anybody

3./etc/pam.d/common-session
# add to the end if need (create home directory automatically at initial login)
session optional        pam_mkhomedir.so skel=/etc/skel umask=077

4./etc/sssd/sssd.conf
ad_gpo_map_interactive = +xrdp-sesman

5. /etc/krb5.conf
[libdefaults]
      default_realm = domainname.local
      default_tgs_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5
      default_tkt_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5

2020年7月11日 星期六

windows server 2003 ad 重建 dns server

1.刪除所有相關dns record
2.net stop netlogon
3.刪除 system32\config\netlogon.dnb,netlogon.dns
  刪除 system32\dns\domain.com.dns,_msdcs.domain.com.dns
4.dns server 指向自己
5.net start netlogon
6.ipconfig /flushdns, ipconfig /registerdns.

windows server 2003 +sssd:generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Ticket expired)

安裝 sp2

2020年7月9日 星期四

/etc/skel/目錄

1.目錄是用來存放新使用者配置檔案的目錄

2.新增新使用者的時候,這個目錄下的所有檔案會自動被複制到新新增的使用者的家目錄下。

3.通過修改、新增、刪除/etc/skel目錄下的檔案,可為新建立的使用者提供統一的、標準的、初始化使用者環境。

2020年7月4日 星期六

nginx: [emerg] unknown "connection_upgrade" variable

http 區塊中加入
 map $http_upgrade $connection_upgrade {
default upgrade;
 '' close;
}

2020年7月3日 星期五

xrdp + sssd

1.編輯 /etc/sssd/sssd.conf 加入
ad_gpo_map_interactive = +xrdp-sesman

2.編輯 /etc/X11/Xwrapper.config 修改
allowed_users = anybody

3.重啟 sssd
systemctl restart sssd

Xpra + Apache2 proxy (Debian 10.4)

1.安裝 XPRA
echo "deb https://xpra.org/ buster main" >/etc/apt/sources.list.d/xpra.list

apt-get install apt-transport-https
wget -q https://xpra.org/gpg.asc -O- | sudo apt-key add -
apt-get update
apt-get install xpra

2.Apache2 載入模組
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
a2enmod proxy_wstunnel

3.修改 Apache2 設定檔,加入
<Location "/xpra">
  RewriteEngine on
  RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
  RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
  RewriteRule .* ws://localhost:14500/%{REQUEST_URI} [P]

  ProxyPass ws://localhost:14500
  ProxyPassReverse ws://localhost:14500

  ProxyPass http://localhost:14500
  ProxyPassReverse http://localhost:14500
</Location>

4.xpra 執行方式
xpra start :100 --start-child=xterm --bind-tcp=0.0.0.0:14500

2020年7月1日 星期三

Debian 10 安裝 Shell in a box

安裝
apt install -y shellinabox

允許 root 登入
修改 /etc/default/shellinabox
SHELLINABOX_ARGS=--no-beep
加入 --service=/:SSH