Linux telnet to windows

Can I connect to Windows machine from Linux shell?

I can connect to Linux machines from Windows using PuTTY/SSH. I want to do the other way round — connect to a Windows machine from Linux. Is this possible?

See answer below: unix.stackexchange.com/a/427739/242983. OpenSSH is now supported natively by the latest update of Windows10. However, its not available for older versions. Please update your Windows10 before trying this.

@Manishearth Because sometimes you just want something that works out of the box with no extra reading required.

8 Answers 8

It depends on how you want to connect. You can create shares on the Windows machine and use smb/cifs to connect to the share.

The syntax would depend based on if you are in a domain or not.

# mount -t cifs //server/share /mnt/server --verbose -o user=UserName,dom=DOMAIN 

You also have the ability to mount the $IPC and administrative shares. You can look into Inter-Process Communication for what you can do via the $IPC share.

With the last 3 you need to install additional software.

  • Kpym (telnet / ssh server)
  • MobaSSH (ssh server)
  • Cygwin (run a Linux environment inside Windows)
  • DamnSmall Linux — inside Windows (like Cygwin run DSL inside Windows)

VNC can be run from a stand-alone binary or installed.

For RDP most Linux systems either already have rdesktop installed or it is available in the package manager. Using rdesktop you only have to enable RDP connections to your Windows system and then you will be able to use RDP for a full GUI Windows console.

If you are on Windows 10 , you can install OpenSSH using the following Powershell script.

#change dns server to 8.8.8.8 so that the OpenSSH stuff can be downloaded netsh interface ip set dns "Ethernet" static 8.8.8.8 #sleep for 60 s so that the DNS server has time to register Start-Sleep -m 60 #check if OpenSSH is already installed or not Get-WindowsCapability -Online | ? Name -like 'OpenSSH*' # Install the OpenSSH Client Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 # Install the OpenSSH Server Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 # Check if OpenSSH is available dism /Online /Get-Capabilities | findstr OpenSSH # install the server and/or client features: dism /Online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0 dism /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0 Install-Module -Force OpenSSHUtils Repair-SshdHostKeyPermission -FilePath C:\Windows\System32\OpenSSH\ssh_host_ed25519_key # start the ssh server daemon Start-Service sshd # This should return a Status of Running Get-Service sshd # add firewall rule to allow inbound and outbound traffic through port 22 New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -Profile Domain 

Please note that this script will change the dns to Google dns. Because OpenSSH is not distributed with the default Windows10 distribution, it will actually download some files from the internet. So you need a working internet connection and a correct dns server, which is why I specified the static dns server, just in case you are behind a firewall or using a static ip with no dns server.

Читайте также:  Linux bash скрипты цикл

Once you have done this, you should figure out the ip address of the Windows host usign

Then from the Linux/Unix OS do

where username is the name of the account and Windows_ip is the ip address of the Windows computer you are trying to log into

Источник

telnet Unix/Linux and download the file to local Windows system

Is it possible to do so: I am on Windows system and telnet Unix/Linux remotely. Then I would like to download file from telnet mode and download to Windows system. Any Unix/Linux command are able to do so? like rcp or ftp. How to do so? Does it require any configuration on both system? i try to write the shell script on Unix/linux side. and i telnet Unix/linux system remotely from local Windows machine and log in to Unix/linux system, run the script on Unix/linux side. some files will be transfered or download automatically to my windows system. assume permission is not a problem

6 Answers 6

You can use x/y/zmodem to transfer file if both ends support that.

On Linux/Unix, you can use sz command to send file via zmodem.

On Windows, both Secure CRT (commercial) or Le Putty (open source) are capable of zmodem.

I think you want PSCP (command line) or WinSCP (GUI).

hey jterrace thank you for ur reply. so is it possible done in telnet mode from windows?. yes i putty can do it.

Usually people use ftp session to transfer files. If permissions is not a problem why don’t you run ftp from your Windows computer?

You can create a windows batch script to load your file. Try something like

ftp hostname user password cd /path/to/file get myfile quit 

hey Oleg Pavliv. i try to write the shell script on Unix/linux side. and i telnet from local Windows machine and log in to Unix/linux system, run the script. some files will be transfered automatically to my windows system. Is that possible ?

How about executing the shell script on Unix/Linux side rather than run the batch on windows. and Unix/Linux remote machine will send file to windows machine. Is is feasible? any solution.

You can run the same script (just replace get with put) on unix if you have ftp server installed on your windows computer.

Источник

How to Use telnet Command in Linux?

Home » Networking » How to Use telnet Command in Linux?

The telnet command (short for teletype network) utilizes the telnet network protocol to connect to remote machines and manage them through a TCP/IP network. The protocol uses port 23 to establish a connection and provides a way to manage remote systems using the CLI.

Although telnet is similar to SSH, the two are different because SSH is a much more secure option as it uses encryption. telnet , on the other hand, sends data without encryption, making it an easy target for hackers.

Читайте также:  Континент ап linux debian

In this tutorial, you will learn to use the telnet command in Linux.

How to use the telnet command in Linux - a tutorial.

  • A system running Linux (for Windows users, learn about telnet on Windows).
  • An account with root privileges.
  • Access to the terminal (Ctrl+Alt+T).

Installing Telnet in Different Linux Distributions

Depending on the Linux distribution you are using, follow the steps below to download and install telnet .

CentOS, Fedora, and RHEL

CentOS, Fedora, and RHEL use yum (Yellowdog Update Manager) as the primary package manager. Follow the steps below:

1. Update the system package repository to make sure the latest version is installed:

2. Run the following commands to install telnet and the telnet server packages required for it to function properly:

sudo yum install telnet telnet-server -y

Installing telnet on RHEL-based Linux distros.

The command installs the two packages. The -y flag automatically answers Yes to any prompts during the installation.

3. After the installation completes, start and enable the telnet service by running:

systemctl start telnet.socket systemctl enable telnet.socket

4. Allow the telnet port (the default port is 23) through the firewall on the remote machine. Run the following command:

sudo firewall-cmd --permanent --add-port=23/tcp

5. Reload the firewall to apply the changes:

Opening a port in RHEL-based distros.

The telnet port is now allowed through the firewall.

Ubuntu and Debian-Based Distributions

Ubuntu and other Debian-based distributions use the apt package manager by default. Follow the steps below to install telnet :

1. Update the system package repository:

2. Run the following command to install telnet :

sudo apt install telnetd -y

Installing telnet on Ubuntu.

Wait for the installation to complete. The service should start automatically.

3. Check if telnet is properly installed by running:

sudo systemctl status inetd

Checking telnet status on Ubuntu.

The output shows that the daemon is up and running.

4. Allow port 23 through the firewall on the remote machine by running:

Allowing port 23 through firewall on Ubuntu.

The telnet port is now allowed through the firewall.

Note: The command above is for the ufw firewall. If you are using a different firewall, follow the instructions for that specific program.

How to Use telnet in Linux

A vital prerequisite for using telnet is to have it installed on both the local and remote machine, and that the default port 23 is allowed through the firewall on the remote machine.

The syntax for the telnet command is:

telnet [options] [remote_server_address] [port]

The [options] and [port] parameters are optional. For [remote_server_address] , telnet accepts symbolic and numeric addresses.

Running the command without options or without specifying an address opens the telnet interactive mode:

Example of the telnet interactive mode.

Use the interactive shell to connect to remote servers, print the connection status, etc.

To end a session and exit telnet , run:

The sections below provide practical telnet use case examples.

Check for Open Ports

Although it is not a secure option for establishing a remote connection, telnet is a great way to check if a specific port is open on a server. Check if a certain port is answering any calls by specifying the port number in the command. Doing so allows you to see what’s going on in a network and if a port is responsive or not.

Читайте также:  Tl wn721n kali linux

1. Use the following syntax:

telnet [server_address] [port]

2. Not specifying a port number defaults to port 23. For example, to check if port 22 is open on a server, run:

Checking if a port is open using telnet.

The connection breaks, which means that the specified port is not open.

3. However, trying port 80 yields a different result:

Connecting to port 80 via telnet.

The output shows that the port is open since the connection was established.

Download Web Page to File

telnet allows users to connect to port 80 of a website and download the HTML source code to the terminal. This allows you to save and inspect the source code, check it for errors, etc.

1. For example, the following command connects to port 80 on google.com:

2. After establishing the connection, download the HTML web page by running:

Downloading the HTML source code of a page using telnet.

The screenshot above shows that the command has downloaded the homepage source code.

3. Save the code to a file or inspect it in the terminal.

Test SMTP Communication

Another useful feature of telnet is that it allows users to test the SMTP port by sending emails directly from the command line. To do so, you need an email server that doesn’t require authentication. It is a great way to troubleshoot problems in an email client.

Note: Want to send and read email using the CLI? See how to use the Linux mail command.

Follow the steps below to send an email using telnet :

1. Connect to the server via the SMTP port:

telnet [server_address] [port]

For [server_address] , specify the SMTP server address. For example, for Gmail it is smtp.gmail.com, while the SMTP [port] can be 25, 465, 587, etc., depending on the provider.

Important: Since May 2022, Google has prohibited access to Google accounts for less secure apps and won’t accept connections from telnet .

2. Greet the server with HELO or EHLO :

5. Specify the subject and email body, separated by a blank line:

SUBJECT: This is the email subject. "" This is the email body.

Note: Most mail servers flag unsolicited anonymous mail, which means that it will likely end up in the spam folder.

Connect to Remote System

If you decide to use telnet for remote connections despite its lack of security, do it by specifying the remote machine’s IP address.

Make sure that telnet is installed on both machines and port 23 is allowed through the firewall on the remote machine.

When prompted, enter the account username and password to log in to the system. After logging in, you can operate the other machine remotely.

Connecting to a remote machine using telnet.

After the connection is established, you are in control of the remote machine.

This tutorial showed how to use the telnet command in Linux. Although it has poor security features and isn’t recommended for remote connections, the command has other uses that make it beneficial.

Next, see how SSH works and why it is more secure than telnet .

Источник

Оцените статью
Adblock
detector