工作日常记录20180129
2018-01-29 本文已影响0人
YongpingZhao
sudo错误处理
sudo: sorry, you must have a tty to run sudo
编辑 /etc/sudoers
1)Defaults requiretty,修改为 #Defaults requiretty,表示不需要控制终端。
2)Defaults requiretty,修改为 Defaults:nobody !requiretty,表示仅 nobody 用户不需要控制终端。
如果修改为 Defaults:%nobody !requiretty,表示仅 nobody 组不需要控制终端。
Python Shell Package: Spur
shell = spur.SshShell(hostname="172.16.3.234", username="root", password="passowrd", missing_host_key=spur.ssh.MissingHostKey.accept)
result = shell.run(["ascp.exe", directory, "root@172.16.3.234:/"], stdout=sys.stdout, update_env=environment)
Tmux配置
unbind ^b
set -g prefix 'C-a'
bind r source-file ~/.tmux.conf \; display-message "Config reloaded"
unbind-key h
bind h select-pane -L
unbind-key j
bind j select-pane -D
unbind-key k
bind k select-pane -U
unbind-key l
bind l select-pane -R
# Rename your terminals
set -g set-titles on
set -g set-titles-string '#(whoami)::#h::#(curl ipecho.net/plain;echo)'
# Status bar customization
set -g status-utf8 on
set -g status-bg black
set -g status-fg white
set -g status-interval 5
set -g status-left-length 90
set -g status-right-length 60
set -g status-left "#[fg=Green]#(whoami)#[fg=white]::#[fg=blue] #(hostname -s)#[fg=white]::##[fg=yellow]#(curl ipecho.net/plain;echo)"
set -g status-justify left
set -g status-right '#[fg=Cyan]#S #[fg=white]%a %d %b %R'
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# set the pane border colors
set -g pane-border-fg colour250
set -g pane-border-bg colour236
set -g pane-active-border-fg colour250
set -g pane-active-border-bg colour250
#bind '"' split-window -c '#{pane_current_path}'
#bind '%' split-window -h -c '#{pane_current_path}'
bind Escape copy-mode
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
unbind p
bind p pasteb
setw -g mode-keys vi # Vi风格选择文本
set -g mouse on