LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-16-2016, 10:29 AM   #16
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled

I really don't know what version of Windows is running on the Windows Share but I just found out some info about the Win Share:

File Transfer Protocol = SFTP-3
Cryptographic protocol = SSH-2

Would this cause issues with connecting via Linux?
 
Old 11-16-2016, 10:41 AM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,397

Rep: Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471
Where did you find that information?

smbclient which uses CIFS is not the same as ssh. WinSCP is a sftp client which connects to the linux ssh server.

For windows 7 Click the Start button The Start button, enter Computer in the search box, right-click Computer, and then click Properties

For Windows 8.x click Settings, and then click Change PC settings. Look under Windows for the version and edition of Windows that your PC is running

For Windows 10, goto start, enter "about your PC" and then select "about your PC"
 
1 members found this post helpful.
Old 11-16-2016, 10:43 AM   #18
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I don't have access to the Windows Share server

Last edited by trickydba; 11-16-2016 at 10:44 AM.
 
Old 11-16-2016, 10:46 AM   #19
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
So maybe I should be using sftp. That is what is being used in the Powershell script that is taking care of this file transfer from linux to windows. I think I tried every combination of sftp and still no success. I have the host key that is being used in the Powershell script but I do not know how to use it in sftp in Linux. I tried everything!!

Last edited by trickydba; 11-16-2016 at 10:47 AM.
 
Old 11-16-2016, 10:50 AM   #20
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,397

Rep: Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471
You need to install a sftp server on your windows box.

Try this
smbclient -L windows_IP_address

Just press the enter key when prompted for a password

Look for something like:
Domain=[WORKGROUP] OS=[Windows 10 Home 14393] Server=[Windows 10 Home 6.3]

It will also display your default windows shares if there are any
 
1 members found this post helpful.
Old 11-16-2016, 10:53 AM   #21
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Ok ok, good news!!! I used sftp username@hostname and got a prompt asking for the password. Inputted the password and sftp> showed up, which means Im in!!!! Only problem is I need this non-interactive, all automated. Also, after getting to the "sftp>" prompt, how do I copy to the Win Share?
 
Old 11-16-2016, 10:58 AM   #22
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,397

Rep: Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471
What username and hostname did you use? Did you use the same username and password that you enter in WinSCP?
 
1 members found this post helpful.
Old 11-16-2016, 11:58 AM   #23
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Yes i did. Is this format wrong:

SFTP WinUserName%WinUserPwd@hostname

Last edited by trickydba; 11-16-2016 at 12:01 PM.
 
Old 11-16-2016, 12:22 PM   #24
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Is there any way I can put the password in a sftp command? I tried sftp username@hostname, entered password at the prompt and was happily shown "sftp>". Only problem is I need the password to be included so I don't have to input it.
 
Old 11-16-2016, 12:30 PM   #25
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,397

Rep: Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471
Your connecting to the linux box not windows. You need to install a sftp server on windows. Dont have time at the moment to explain the client server model.

Last edited by michaelk; 11-16-2016 at 12:39 PM.
 
1 members found this post helpful.
Old 11-16-2016, 01:23 PM   #26
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
It is installed on the Windows side. That's how I am able to use WinSCP and the Powershell script
 
Old 11-16-2016, 01:27 PM   #27
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,833

Rep: Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761
Quote:
Originally Posted by trickydba View Post
@TB0ne..I tried your suggestion.the response..... only root can do that 8.((((
Ok...so type in "sudo" before the command. Or become the root user and run the command. Not difficult.
Quote:
Originally Posted by trickydba
It should not be THIS hard ugh!
It's only this hard because you're dealing with a Windows machine.

Last edited by TB0ne; 11-16-2016 at 01:28 PM.
 
1 members found this post helpful.
Old 11-16-2016, 01:48 PM   #28
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Is there a way I can actually put the host key in a bash script? This is very frustrating. Everything I need to be done can be done but I have to MANUALLY input a password. Once I get past having to input the password manually, everything else will be easy to put in my bash script
 
Old 11-16-2016, 02:44 PM   #29
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,397

Rep: Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471Reputation: 5471
You did not fully explain your configuration and I made some wrong assumptions ie. did not pay enough attention to the details. The private key is typically located in your users home/.ssh directory. The default key name is id_rsa. To specify a key on the command line use the -i option. If you created your keys with puttygen then it has to be converted to the ssh format via putty.

https://winscp.net/eng/docs/guide_wi...openssh_server

Last edited by michaelk; 11-16-2016 at 02:55 PM.
 
Old 11-21-2016, 01:37 PM   #30
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I have actually installed the package expect and my issue has been resolved. Not the best because it it unsecure, but it's a short term solution. Here is the code:

expect -c "
spawn sftp username@hostname
expect "assword"
send "password is here\r"
expect "sftp>"
send "cd /folder to place file\r"
expect "sftp>"
send "put *.DAT\r"
expect "sftp>"
send "exit\r"
interact "

You might not need all of the lines but I needed to do certain things. Hope this helps!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Create manual entry in kernel source vviivveekkk Linux - Kernel 2 03-04-2014 03:46 PM
No manual entry for smidump akagrawal3 Linux - Newbie 1 02-08-2013 09:10 AM
Manual entry for gzcat abhinav4 Linux - Newbie 6 08-17-2011 06:29 PM
how to get manual entry for capinfo abirami Linux - Networking 1 10-14-2004 11:14 AM
Samba: Removing password on Linux to Windows sharing nairnie Linux - Networking 2 11-26-2003 06:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration