首页 > 其他分享 >openssh

openssh

时间:2023-08-03 22:04:16浏览次数:32  
标签:use passwd openssh domain will file directory

正在使用的文件在windows下无法使用ftp工具下载,就考虑在windows下建立open ssh server,然后使用ssh client来下载的方式解决。

openssh forwindows安装文件及相关说明如下:

http://sourceforge.net/projects/sshwindows/

http://sshwindows.sourceforge.net/

http://www.openssh.com/

readme.txt:

Configuration ------------- The most important step in getting the server to properly run is to correctly set up the passwd file. The passwd file is equivalent to the /etc/passwd file in UNIX-based systems. You will need to set up the passwd file before any logins can take place.

Passwd creation is fairly easy. The majority of user additions take place through the mkpasswd program. You must also create a group file with mkgroup. Mkgroup is included in the bin directory along with a slightly modified version of mkpasswd. Mkpasswd has been changed to automatically use /bin/switch as the default shell.

The steps to creating proper group and passwd files is outlined below. To add local groups to the group file, you use the -l switch, for domain groups, use the -d switch:   mkgroup -l >> ..\etc\group      (local groups)   mkgroup -d >> ..\etc\group      (domain groups)

If you use both commands, the group file will contain duplicates. You will need to remove these by hand in a text editor.

You will now need to create a passwd file. Any users in the passwd file will be able to log on with SSH. For this reason, it is recommended that you add users individually with the -u switch. To add ALL users on a system or domain, do not use the -u switch. As with mkgroup, local users are indicated with the -l switch and domain users are indicated by the -d switch. To add domain users from a domain that is not the primary domain of the machine, add the domain name after the user name:   mkpasswd -l [-u <username>] >> ..\etc\passwd    (add username to passwd - local user)   mkpasswd -d [-u <username>] >> ..\etc\passwd    (add username to passwd - domain user)

The passwd and group files are plain text and can be edited in Vim, Notepad or any text editor. Vim is recommended because it respects the default format of the files.

The last two entries for each user are safe to edit by hand, and can be customized to suit your needs. The second to last entry (/home/username) can be replaced with any other directory to act as that user's home directory (what directory they will be in after they log in). If you will be placing the user somewhere outside the default directory for their Windows profile, you will need to use the cygdrive notation explained below or edit the directory /home maps to. The last entry in passwd is the program that runs when you connect with SSH. The default shell is /bin/switch, which is the best choice for about 99.9% of the accounts you will be adding. Switch.exe allows the use of scp and sftp while still providing the standard command prompt with SSH by switching between sh.exe (scp/sftp) and cmd.exe. If you do not want sftp/scp access for a particular account you can set the shell to /bin/quietcmd.bat, which only runs cmd.exe.

Note that changes made to group are not automatically used by the ssh service. You will need to restart the OpenSSHd service before those changes can be used. Changes to passwd should be automatically used, but restarting the service will help if the changes are not applied automatically.

 

The /home Directory ------------------- In the passwd file, you will notice that the user's home directory is set as /home/username, with username being the name of the account. In the default install, the /home directory is set to the default profile directory for all users. This is usually C:\Documents and Settings on Windows 2000 and XP, and C:\WINNT\Profiles on Windows NT 4.0. The location of /home can be edited to fit your special requirements by editing a registry key.

To change the Windows directory /home corresponds to, you will need to edit a registry entry under HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home. The value of the key named "native" is the directory that /home is. If you want all your users to enter in a directory on your machine called F:\Users, change "native" to read F:\Users. By default, each user will then be placed in the directory F:\Users\username, where username is the name of the user account. To place the user directly under f:\Users, change the home directory in passwd to /home.

 

 

quickstart.txt:

Install -------

Run the setup program and accept the defaults (all categories). This will install the OpenSSH server and client in an appropiate place.

 

Configuration ------------- 1.  Open a command prompt and change to the installation directory (Program Files\OpenSSH is the default).

2.  CD into the bin directory.

3.  Use mkgroup to create a group permissions file. For local groups, use the "-l" switch. For domain groups, use the "-d" switch.     For both domain and local, it is best to run the command twice (remember to use >>, not >). If you use both, make sure to edit the file to remove any duplicate entires.

      mkgroup -l >> ..\etc\group      (local groups)       mkgroup -d >> ..\etc\group      (domain groups)

4.  Use mkpasswd to add authorized users into the passwd file. For local users, use the "-l" switch. For domain users, use the "-d" switch.     For both domain and local, it is best to run the command twice (remember to use >>, not >). If you use both, make sure to edit the file to remove any duplicate entires.

      mkpasswd -l [-u <username>] >> ..\etc\passwd      (local users)       mkpasswd -d [-u <username>] >> ..\etc\passwd      (domain users)

    NOTE: To add users from a domain that is not the primary domain of the machine, add the domain name after the user name.     NOTE: Ommitting the username switch adds ALL users from the machine or domain, including service accounts and the Guest account.

5.  Start the OpenSSH server.

      net start opensshd

6.  Test the server. Using a seperate machine as the client is best. If you connect but the connection immediately gets dropped, reboot the machine with the server and try connecting again.

 

Usage and Important Notes ------------------------- Remember that the CYGWIN OpenSSH utilities are not graphical and are command-line based. Look at PuTTY, SSH Secure Shell, etc for graphical configuration. For more advanced ways to use the programs, look at the manual pages in the documentation directory.

SSH (client program):     ssh <user@servername>

SCP (file copy):     scp <localfilename> <user@servername>:<destinationdirectory>       or     scp <user@servername>:<remotefilename> <localfilename>       or     scp <user@servername>:<remotefilename> <user@otherservername>:<destinationdirectory>

SFTP (ftp):     sftp <user@servername>

NOTE: While regular SSH provides a familiar Windows commandline, SCP and SFTP as well as the passwd file use Unix-style paths. This is due partly to the Unix history of SSH, and to the Cygwin source of the tools.

Paths in SCP and SFTP as well as the home directory listing in passwd use Unix notation. To access directories outside of the OpenSSH directory structure, use the Cygdrive notation described in readme.txt. Further explanation is in readme.txt.

http://www.360doc.com/content/12/0311/00/3446769_193391215.shtml

http://blog.chinaunix.net/uid-7541208-id-2612830.html

 



标签:use,passwd,openssh,domain,will,file,directory
From: https://blog.51cto.com/u_15147537/6953587

相关文章

  • [转]PuTTY的ppk密钥与OpenSSH密钥之间的相互转换
    在手机上使用juiceSSH用密钥连接服务器,以前是用win10命令行生成的私钥,使用没有问题,这次换了MobaXterm带的工具(后来发现应该是开源的PuTTY项目里的工具)生成的密钥,就登不上了,最后用文本编辑器打开两种密钥,发现格式大不一样,遂查找转换方法,找到一篇说的比较明白,特转载备用......
  • Centos7 离线升级openssh到9.3p1
    参考:https://blog.csdn.net/qq_29768197/article/details/125048720参考:https://blog.csdn.net/weixin_46739058/article/details/129189927 1、官方下载地址:http://www.zlib.net/     zlib-1.2.12.tar.gzwget http://www.zlib.net/zlib-1.2.13.tar.gz 2、官方......
  • centos7 openssh升级到9.3.p1
    配置openssh目录cp/etc/ssh/sshd_config/etc/ssh/sshd_config.bakcp/etc/pam.d/sshd/etc/pam.d/sshd.bakmkdir-p/root/opensshcd/root/openssh上传已经制作好的openssh包openssh-9.3p1-1.el7.x86_64.rpmopenssh-clients-9.3p1-1.el7.x86_64.rpmopenssh-server-9.3......
  • openssh升级(centos7.6)
    OpenSSH升级上传软件包openssh-8.1p1.tar.gz1.安装telnet服务   yum-yinstalltelnet-server*telnet(yuminstall-yxinetd)   vi/etc/xinetd.d/telnet(将其中disable字段的yes改为no以启用telnet服务)   mv/etc/securetty/etc/securetty.old......
  • centos8.3 openssh8.0p1升级到9.0P1代码
    #!/bin/shcd/etc/yum.repos.dmkdirbackupmvCent*backupwget-O/etc/yum.repos.d/CentOS-Base.repohttps://mirrors.aliyun.com/repo/Centos-8.repoyum-ycleanallyum-ymakecacheyum-yinstallgccgcc-c++glibcmakeautoconfopensslopenssl-deve......
  • 升级OpenSSL OpenSSH --2023年6月15日
    2023年6月15日升级OpenSSLOpenSSH#查看openssh版本命令ssh-V#查看openssl版本命令opensslversion当前版本[root@node01~]#ssh-VOpenSSH_7.4p1,OpenSSL1.0.2k-fips26Jan2017[root@node01~]#opensslversionOpenSSL1.0.2k-fips26Jan2017......
  • 源码编译安装openssh 最新版
    #创建几个目录备用mkdir-p/usr/local/zlib/mkdir-p/usr/local/openssl/mkdir-p/usr/local/openssh/ #安装编译需要用到的依赖包yum-yinstallwgetdnfvimgccgcc-c++makeperlpam-devel #下载相关源码包cd/rootwgethttps://ftp.openbsd.org/pub......
  • openssh安装升级
    一、安装依赖zlib-1.2.11.tar.gzhttps://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gztar-zxvfzlib-1.2.11.tar.gzcdzlib-1.2.11./configuremake&&makeinstall二、安装opensslopenssl-1.1.1n.tar.gzhttps://www.openssl.org/source/o......
  • ubuntu20.4桌面版安装openssh失败
    问题现象:输入命令sudoapt-getinstallopenssh-server后提示以下现象:下列软件包有为满足的依赖关系:openssh-server:依赖:openssh-client(=1:7.6p1-4)依赖:openssh-sftp-server但是它将不会被安装推荐:ssh-import-id但是它将不会被安装E:无法修正错误,因为您要求某些软件包......
  • 巧用OpenSSH进行域内权限维持
    最近在Windows服务器上安装OpenSSH,意外发现了一个很有意思的技巧,可用来做域内权限维持,废话不多说,直接上步骤。01、利用方式(1)在已经获得权限的Windows服务器上,使用msiexec安装openssh,一行命令静默安装,不需要任何设置。msiexec/i"http://x.x.x.x/OpenSSH-Win64.msi"(2)在默认......