debian-vm-pc-myset-ssh+securt不断链

来源:互联网 发布:淘宝规蜜网址 编辑:程序博客网 时间:2024/06/03 21:42

debian 8 ,vm,

1\locale
root@debian:/home/myusername# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=”en_US.UTF-8”
LC_NUMERIC=”en_US.UTF-8”
LC_TIME=”en_US.UTF-8”
LC_COLLATE=”en_US.UTF-8”
LC_MONETARY=”en_US.UTF-8”
LC_MESSAGES=”en_US.UTF-8”
LC_PAPER=”en_US.UTF-8”
LC_NAME=”en_US.UTF-8”
LC_ADDRESS=”en_US.UTF-8”
LC_TELEPHONE=”en_US.UTF-8”
LC_MEASUREMENT=”en_US.UTF-8”
LC_IDENTIFICATION=”en_US.UTF-8”
LC_ALL=
root@debian:/home/myusername#

2\disk
root@debian:/home/myusername# df -lm
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda3 2002 519 1362 28% /
udev 10 0 10 0% /dev
tmpfs 98 5 94 5% /run
/dev/sda6 2365 667 1559 30% /usr
tmpfs 245 0 245 0% /dev/shm
tmpfs 5 0 5 0% /run/lock
tmpfs 245 0 245 0% /sys/fs/cgroup
/dev/sda5 2377 331 1906 15% /home
/dev/sda2 181 30 139 18% /boot
root@debian:/home/myusername#

root@debian:/home/myusername# fdisk -l

Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4c88548f

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953791 1951744 953M 82 Linux swap / Solaris
/dev/sda2 * 1953792 2344959 391168 191M 83 Linux
/dev/sda3 2344960 6641663 4296704 2.1G 83 Linux
/dev/sda4 6643710 16775167 10131458 4.9G 5 Extended
/dev/sda5 6643712 11720703 5076992 2.4G 83 Linux
/dev/sda6 11722752 16775167 5052416 2.4G 83 Linux

3\==========.vimrc @cd ~

root@debian:/home/myusername# cat .vimrc
set nu
syntax on
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8
set autoindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set list
let autosave=5
set hlsearch

4\vim .bashrc

78 alias ls=’ls –color=auto’82aliasgrep=grepcolor=auto
83 alias fgrep=’fgrep –color=auto’$

91 alias ll=’ls -al’92aliasla=lsA

5\source.list:

deb http://mirrors.sohu.com/debian/ jessie main non-free contrib$
deb http://mirrors.sohu.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie main non-free contrib$
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib $

6\vim etc/fstab,virtualbox自动生成。

$

/ was on /dev/sda3 during installation$

UUID=5822e2d2-dccc-4691-a4b6-dbfc795d6d5d / ext4 errors=remount-ro 0 1$

/boot was on /dev/sda2 during installation$

UUID=b0f558ec-dfb7-4118-a988-692901a20ac2 /boot ext4 defaults 0 2$

/home was on /dev/sda5 during installation$

UUID=5bbd7078-8d49-460c-9837-0bf8f083224a /home ext4 defaults 0 2$

/usr was on /dev/sda6 during installation$

UUID=1e568983-f9bd-41b1-bcf5-7060c390c42c /usr ext4 defaults 0 2$

swap was on /dev/sda1 during installation$

UUID=39366567-efb8-4262-88b0-776d86a1413d none swap sw 0 0/dev/sr0/media/cdrom0udf,iso9660user,noauto00

3\/etc/hosts
61.49.39.138^Iwww.bjguahao.gov.cn$

4\/etc/network/interfaces 网卡设置

auto loifaceloinetloopback
$

The primary network interface$

allow-hotplug eth0ifaceeth0inetdhcp

5\sudoers:
apt-get install sudo,vim /etc/sudoers

$

Defaults^Ienv_resetDefaultsImailbadpass
Defaults^Isecure_path=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”$

root^IALL=(ALL:ALL) ALL$
myusername ALL=(ALL:ALL) ALL$

Allow members of group sudo to execute any command$

%sudo^IALL=(ALL:ALL) ALL$

6\防止securcrt 和sshd 断链

七、ssh防断链和securecrt的配置。
工作时,ssh时不时断链,导致影响工作。
1、sshd 服务端的配置:
/etc/sshvimsshdconfig45PermitEmptyPasswordsno
68 TCPKeepAlive yes –tcpalive包
78 ClientAliveInterval 60sshdtcp79ClientAliveCountMax99999 –没有操作时,维持tcp包最大发送次数
95 MaxSessions 30 —最大允许,一个连接可以clone的会话数。
即securecrt一个连接,运行clone session 可以copy建立的窗口数。
vim /etc/ssh/sshd_config:
http://unix.stackexchange.com/questions/26170/sshd-config-maxsessions-parameter

sshd_config MaxSessions parameter

From sshd_config(5)

MaxSessions Specifies the maximum number of open sessions permitted per network connection. The default is 10.

Added a MaxSessions option to sshd_config(5) to allow control of the number of multiplexed sessions supported over a single TCP connection. This allows increasing the number of allowed sessions above the previous default of 10, disabling connection multiplexing (MaxSessions=1) or disallowing login/shell/subsystem sessions entirely (MaxSessions=0).

Effectively, the MaxSessions parameter is meant to limit the number of multiplexed ssh sessions you can have over a single ssh session. See the ControlMaster section of ssh_config(5).

Session multiplexing allows you to setup a single Master connection which all other connections to the same host can then reuse (but they don’t have to). This has no effect on port forwarding, or SOCKS proxying. It also has no effect on my ability to connect again to the same host via a new network connection. It is really specific to connection multiplexing, and nothing more.

2、securecrt的配置
这里写图片描述
不要选自动建链。
这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述
可以选择这两种字体。为了显示中文,linux机器端,需要配置为utf-8。为了securecrt端能够显示中文,必须配置为gb2312或者gbk的字符集,字符集的编码方式使用utf-8。这样才能正确显示中文,而不是乱码。

这里写图片描述

八、解决中文乱码问题
见本blog的另外一篇帖子 解决linux下查看文件编码及乱码

九、

  1. current env set

XDG_VTNR=6
SSH_AGENT_PID=846
XDG_SESSION_ID=2
CLUTTER_IM_MODULE=xim
GPG_AGENT_INFO=/run/user/1000/keyring/gpg:0:1
TERM=xterm
SHELL=/bin/bash
XDG_MENU_PREFIX=gnome-
VTE_VERSION=3801
GJS_DEBUG_OUTPUT=stderr
WINDOWID=37751080
HUSHLOGIN=FALSE
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
USER=myusername
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SESSION_MANAGER=local/debian:@/tmp/.ICE-unix/816,unix/debian:/tmp/.ICE-unix/816
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
MAIL=/var/mail/myusername
QT_IM_MODULE=fcitx
PWD=/mnt/f/install-notes-debian8-pc
XMODIFIERS=@im=fcitx
LANG=en_US.UTF-8
XDG_SEAT=seat0
HOME=/home/myusername
SHLVL=2
LANGUAGE=en_US:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=myusername
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
QT4_IM_MODULE=fcitx
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-DpzFNvr9WK,guid=e5a0c77223ce58bb8144e6965659d0e6
WINDOWPATH=6
TEXTDOMAIN=im-config
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=GNOME
GTK_IM_MODULE=fcitx
TEXTDOMAINDIR=/usr/share/locale/
XAUTHORITY=/home/myusername/.Xauthority
_=/usr/bin/env

0 0