简体   繁体   English

如何使用python脚本在远程系统中创建目录

[英]How to create directory in remote system using python script

I want to create a directory in my remote system using python script or by socket programming.我想使用 python 脚本或通过套接字编程在我的远程系统中创建一个目录。 I have remote system's Username, password and IP address.我有远程系统的用户名、密码和 IP 地址。 I am able to do this in my local machine but not in remote.我可以在本地机器上执行此操作,但不能在远程机器上执行此操作。 Please help!请帮忙!

下载Putty然后连接到远程系统)并在终端中写入mkdir foldername

To create a directory on a remote machine, you will have to first connect to it.Telnet and SSH and SSH is used to connect to remote machines.要在远程机器上创建目录,您必须先连接到它。Telnet 和 SSH 和 SSH 用于连接到远程机器。 Obviously TELNET or SSH service should be running on the remote machine, otherwise you won't be able to connect.Since in case of Telnet,data is transfered in plain text, it's better to use SSH protocol.显然远程机器上应该运行TELNET或SSH服务,否则将无法连接。由于在Telnet的情况下,数据是以明文传输的,最好使用SSH协议。

Once connected to the remote machine using SSH, you will be able to execute commands on the remote machine.使用 SSH 连接到远程计算机后,您将能够在远程计算机上执行命令。

Now since you want to do everything in Python, you will have to write a complete SSH client in Python.现在,既然你想用 Python 做所有事情,你就必须用 Python 编写一个完整的 SSH 客户端。 Which is greate for learning, because you will learn about socket programming and cryptography.这对学习很有帮助,因为您将学习套接字编程和密码学。

If you are in a hurry, you can use a good SSH library.如果你赶时间,你可以使用一个好的 SSH 库。

If you are getting network connection error, please check whether SSH is installed in the remote machine or not.如果您遇到网络连接错误,请检查远程计算机中是否安装了 SSH。 If yes, then check firewall settings.如果是,请检查防火墙设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 WMI -(Windows Management Instrumentation)从 python 脚本获取远程系统硬件信息 - How can I get remote system hardware information using WMI -( Windows Management Instrumentation) from python script 如何通过python脚本重新启动远程系统? - How do I reboot the remote system via python script? 如何使用 python 脚本重新启动远程桌面? - how to reboot remote desktop using python script? 使用python2.7在远程文件系统上移动文件(目录到目录) - Move files (directory to directory) on a remote file system using python2.7 远程目录中的Python脚本非常慢 - Python script very slow in a remote directory python在另一个目录中执行远程脚本 - python executing a remote script in a different directory 通过python脚本在docker中创建目录 - create directory in docker by python script 如何从远程系统使用Python在VMware中格式化磁盘? - How to format a disk in VMware, using Python from a remote system? 如何使用python.pathlib.Path在根目录中创建目录? - How to create a directory in root directory using python.pathlib.Path? 使用python,如何在目录中找到不同的python脚本然后运行 - Using python, how to find a different python script in a directory and then run it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM