分享
 
 
 

SSHDSetup

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

Use the following steps to successfully get OpenSSH working as a server:

Set up your environment for Cygwin. For NT 4 and Windows 2000, this is done by right-clicking on My Computer and choosing Properties. In NT4, it's on the Environment tab. In Windows 2000, it's the Environment Variables on the Advanced tab. Add the following setting to the System Environment:

CYGWIN = ntsec tty

Append the following variable to contain the following:

Path : ;C:Cygwinin

Note that if you are NT/2K on FAT(32), the ntsec option for the CYGWIN variable won't help you much. In these cases, just set CYGWIN to "tty".

Download the Cygwin Setup Program into a temporary folder like C:CygwinInstall.

Run "C:CygwinInstallSetup.exe", choose " Install from Internet ", choose a suitable mirror (I like "ftp://mirrors.rcn.net").

Now choose the packages you want to install. Click on the View button in the upper right corner. Scroll down until you find Cygrunsrv. Click on the word "Skip" until you see the highest numbered version for Cygrunsrv. This will cycle through the list, so you may have to go through it twice or three times, but you basically want the one right before "Skip" in the cycle. Repeat for man, openssh and vim. Feel free to choose other packages you may want (like ncftp, lynx and shutdown), but chances are, if you don't know what it is, you don't need it. Setup automatically chooses other packages that your selections depend on. Continue through the setup program until the installation is complete.

[Optional] After Setup is complete, I like to make a couple of changes to the default installation: - Download and install ftp://ftp.erdelynet.com/mike/cygwin/profile, ftp://ftp.erdelynet.com/mike/cygwin/sh_aliases into /etc. - Change the Cygwin icons so that, instead of pointing to cygwin.bat, they point to "c:cygwininash.exe --login -i" and start in "c:cygwinin"

Since you're going to be running an internet service, you're definitely going to want to clean up your /etc/passwd and /etc/group files. You only want everyone, system, administrators and the users that you want logging into your system defined in your /etc/passwd. If you have guest enabled and guest is defined in your /etc/passwd, people will be able to log onto your system without a password. In addition to removing unwanted users, I also shorten "Administrator" and "Administrators" and make all username fields lowercase. Here are my files:

/etc/passwd:

everyone:*:0:0:,S-1-1-0::/bin/false

system:*:18:18:,S-1-5-18::/bin/false

admins:*:544:544:Administrators,U-SATURNAdministrators

,S-1-5-32-544::/bin/false

admin::500:544:U-TESTADAdministrator

,S-1-5-21-SID-500:/home/admin:/bin/bash

mike::1106:513:Michael Erdely,U-TESTADmike

,S-1-5-21-SID-1106:/home/mike:/bin/bash

(note: the lines for admins, admin and mike are intentially wrapped for readability, but in your /etc/passwd file, they should be on one, continuous line.

/etc/group:

everyone:S-1-1-0:0:

system:S-1-5-18:18:

admins:S-1-5-32-544:544:

users:S-1-5-32-545:545:

guests:S-1-5-32-546:546:

You'll notice in the /etc/group, that I made all group names lowercase, shortened Administrators to admins and deleted unwanted group names. In the /etc/passwd, I shortened Administrators to admins, Administrator to admin (both username field and home directory field), deleted guest and made everyone's, system's and admins' shell "bin/false" and made all usernames lowercase. This example has a domain (TESTAD). If you want to add users in the future, you'd run either "mkpasswd -l | grep newusername >> /etc/passwd" to add from the local machine, "mkpasswd -d | grep newusername >> /etc/passwd" to add a user from the default domain or "mkpasswd -d otherdomain | grep newusername >> /etc/passwd" to add them from OTHERDOMAIN. Please note: newusername and otherdomain are just examples. You'd want to replace them with actual user and domain names.

If you are using NTFS and included NTSEC in your CYGWIN variable (first step of these instructions), you'll want to run my fixperms script (ftp://ftp.erdelynet.com/mike/cygwin/fixperms.sh). Download it to your home directory, then run ". ~/fixperms.sh". Yes, that is a period, space, then the path to the script.

Now, you'll want to configure sshd. This is MUCH simpler than it used to be. Run "ssh-host-config -y" to set it up. When prompted with "CYGWIN=" type what you set CYGWIN to in step 1 (tty ntsec).

Change the permissions of a couple of files:

chown -R 544:544 /var

chown 18:18 /var/log/sshd.log

chown 544:544 /etc/ssh*

chown 18:18 /etc/ssh_host*_key

Now you are ready to start the service: "cygrunsrv -S sshd"

Test the service by running "ssh localhost"

If, at this point, you are unable to connect to your sshd server, join my SSH-L mailing list for extra help.

If your ultimate goal (like mine was) is to connect to the SSH server with a GUI client like Van Dyke's SecureCRT (listed on my downloads page), now try that. At this point, also test connecting to your SSH server from a different machine to ensure network connectivity.

If this is unclear or if you have any questions, join my SSH-L mailing list.

--------------------------------------------------------------------------------

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有