I have a windows VM which has been configured with the mksnt toolkit. So what that would imply is my path would become C:/abc/xyz
I am trying to connect from a linux box using Jsch utilty to this windows machine remotely. I am able to connect successfully and when I try to check for a particular directory path, it says it does not exist. However, the path does exist on the windows box.
Following is my Jsch code that looks for the destination directory -
SftpATTRS dirAttributes=null;
try{
testLog.info("Looking for directory :"+destinationDir);
dirAttributes = sftpc.stat(destinationDir);
} catch(SftpException s){
testLog.info("Directory does not exists !!!\n"+s.fillInStackTrace().toString());;
} catch (Exception e){
testLog.info("Directory does not exists !!!\n"+e.fillInStackTrace().toString());;
}
The above code works seamlessly if I do Linux <-> Linux remote calls and validate the directory but with Linux <-> Windows I am encountering this issue.
Since mksnt is installed, if I go to the directory and do "pwd" - it prints "C:/abc/xyz"
I am not clear if Jsch is not able to handle or recognize the paths due to mksnt installed.
Could anybody please share any solution or provide some pointer that may help me to resolve this.
PS: I cannot install cygwin or any other tool. This is the env. provided to me and I need to make remote calls from Linux host via Jsch utility only.
C:/abc/xyz
The SFTP protocol uses a unix-like naming scheme for file pathnames, regardless of the SFTP server's operating system. In the SFTP naming scheme, absolute pathnames begin with "/". A name beginning with "C" would reference a file in the SFTP session's working directory.
In other words, a Windows-based SFTP server might not interpret this pathname the way you expect it to. You should use an interactive SFTP client to log into the Windows SFTP server, locate the files and/or directories that you're interested in, and determine the correct path to use to access them through SFTP.
If the Windows SFTP server is running the Cygwin OpenSSH SFTP server, I believe the correct path would be something like "/cygdrive/c/abc/xyz".
I have faced the same issue in the past and I have solved using the following code:
String remoteFolder = "C:\temp\test"
remoteFolder = "/" + remoteFolder.replace("\\", "/");
With this JSCH can detect if the remote path exists or not. This is only required in Windows.
Related
I don't use mac very often and am trying to figure out what the correct URL is to connect to a repository shared from my windows machine. I was thinking of something like file://\winMachine/svnrepo, but that's not working.
I don't see how that would differ from normal ways of accessing network shared resources. The only issue here would be that OSX might not resolve NETBIOS names, so you might want to use the IP.
You should clone the repository through command line or GUI using the URL provided by the SVN Server, ex.: http://10.0.0.1:8080/svn/Project/
[yurieastwood#mbp ~]$ svn checkout --username yeastwood http://10.0.0.1:8080/svn/SampleProject/trunk/
Authentication realm: <http://10.0.0.1:8080> VisualSVN Server
Password for 'yeastwood': *********
A trunk/SampleProject.XmlImporter
A trunk/SampleProject.XmlImporter/SampleProject.XmlImporter.csproj
A trunk/SampleProject.XmlImporter/JsonConvertTask.cs
A trunk/SampleProject.XmlImporter/packages.config
A trunk/SampleProject.XmlImporter/bin
A trunk/SampleProject.XmlImporter/bin/Release
A trunk/SampleProject.XmlImporter/bin/Debug
A trunk/SampleProject.XmlImporter/bin/Debug/SampleProject.Framework.pdb
A trunk/SampleProject.XmlImporter/bin/Debug/Autorun.mdf
A trunk/SampleProject.XmlImporter/bin/Debug/Autorun_log.LDF
A trunk/SampleProject.XmlImporter/bin/Debug/SampleProject.XmlImporter.pdb
A trunk/SampleProject.XmlImporter/bin/Debug/SampleProject.Framework.dll
A trunk/SampleProject.XmlImporter/bin/Debug/Newtonsoft.Json.dll
A trunk/SampleProject.XmlImporter/bin/Debug/SampleProject.XmlImporter.dll
A trunk/SampleProject.XmlImporter/bin/Debug/Newtonsoft.Json.xml
Checked out revision 7.
[yurieastwood#mbp ~]$
P.S.: If you want to access shared folders from Windows machines you should use the SMB protocol, ex.: smb://10.0.0.1, through Finder -> Go -> Connect to Servers.
I'm using Windows 7 and cygwin. I want to connect to our CVS repository with the following command:
cvs -d :ext:my_username#my_ip:/my_repo_path/ checkout my-parent
Unfortunately I'm getting this error:
my_ip:514: Connection refused
How can I provide a password so that I'm able to connect to the server?
my_ip:514: Connection refused
The cvs "ext" method connects using rsh (remote shell) by default. Port 514 is the standard rsh port. The error "Connection refused" normally means that the remote host isn't accepting connections on the requested port.
In other words, you tried to connect to the remote host using rsh, not ssh. But the remote server doesn't accept rsh sessions. This isn't very surprising, because rsh is a very insecure protocol and it's not widely used any more.
To make CVS use ssh instead of rsh, you need to set the CVS_RSH environment variable:
$ CVS_RSH=ssh; export CVS_RSH
On unix or linux, you'd normally add this line to your .bashrc, .profile, or one of your other shell startup files so that it's set automatically when you log in. On Windows, this http://superuser.com answer describes how to set environment variables. If you're on Windows, you may also need to install an ssh program, because Windows doesn't come with one.
Once cvs is set to use ssh, ssh will prompt you to type a password if it needs one.
The book Open Source Development with CVS has a section about the different cvs repository access methods, including how to set the "ext" method to use ssh.
I have the following code:
$file_name = "1234";
$filename = "L:\\videoette_converter\\batch_files\\".$file_name.'.bat';
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
I get the following error from that code:
Warning: fopen(L:\videoette_converter\batch_files\1234.bat)
[function.fopen]: failed to open stream: No such file or directory in
C:\wamp\www\videoette_converter\index.php on line 47
and the debug line from my php
Cannot open file (L:\videoette_converter\batch_files\1234.bat)
However the folder L:\videoette_converter\batch_files does exist as a mapped drive, and I have given "Everyone" full permissions. What could be the problem?
Are you sure there's no domain controller in the way?
When the Windows machine that serves the files is in an Active Directory domain:
1) The machine that runs the WAMP must be in the same domain.
2) The account used to run the Apache service on your WAMP machine must have at least read rights on the share you want to access. Instead of running the Apache service as "Local System" or "wampapache" you should specify your domain user account. (P.S.: I like XAMPP over Wamp for this kind of development, but that's probably just a personal preference)
Also I'm guessing id'd be better if you used a UNC path instead of a drive letter. It always worked for me that way. You don't need to use escaped backslashes, you can replace them with single forward ones:
//yourwinserver/sharename/path/to/file.bat
I am using SFTP client(WinSCP) to get into a remote server and retrieve some files. I could not get to the SFTP server when I use WinSCP in a Windows-7 machine; but it works good when I try it from an XP machine. Can anyone think of what might be wrong. Any help appreciated!
I am also including the error screenshot, if that helps
Can anyone please help!
This could be some problem with your firewall. Check it if you are blocking WinSCP.
Quoting WinSCP documentation on the error message Server unexpectedly closed network connection:
If you get this error message while connecting to your server, it is
most usually caused by the server not being able to run some process
necessary to support your session. Always try to connect with another
SSH (SFTP) client to find, if it is server or client related problem.
Possibilities are:
Shell.
Your account may not be allowed to start a shell at all. With some servers (like OpenSSH or Sun SSH), you may need to be allowed to
start a shell, even if using SFTP protocol.
Also some servers refuse to start a shell if your password has expired or your account was terminated.
Some shells do not work with non-interactive sessions. The same it true for some configurations (or profiles used) for otherwise
working shells. This commonly exhibits with SCP protocol with
associated error message "Error skipping startup message. Your shell
is probably incompatible with the application (BASH is recommended)."
Try to force bash shell explicitly on SCP/Shell page of Advanced Site
Settings dialog. Using SFTP protocol instead of SCP is another option.
OpenSSH server may fail to start shell when chroot is configured, but not possible (e.g. due to group writeable permissions
to chroot directory).
Some environments require specific permissions (e.g. 755) to files like .profile or .bashrc.
SFTP server.
Your account may not be able to start SFTP server binary (e.g. /bin/sftp-server) or the binary is not present on your server.
Your SSH server may also lack the SFTP subsystem.
SSH server:
Your SSH server, particularly OpenSSH, may not be able to access the server key files, due to an incorrect permissions.
Here are the details:
I installed the oracle instant client 11.2.0.2.0 from the OTN download page on a windows 7 64 bit vm (vmware).
I am trying to to connect to a remote oracle database, and I can successfully connect with one program using TNS, but not with SQL*Plus and other applications.
Trying to connect with SQL*Plus, using schema#servicename, password, etc, gives the above error.
To connect via SQL Developer, normally I would use the basic connection info and not rely on tnsnames, but trying a normal connection gives me: io error: unknown host specified. SQL Developer can successfully connect and query database if i use the TNS protocol.
Trying from other programs gives me the same error I got with SQL*Plus. Same when trying with the service name from tnsnames.
This is obviously quite frustrating for it to work one way and not the other. I followed all the normal instructions for using the instant client, the directory with instantclient has been addded to the PATH, a TNS_ADMIN entry has also been created, with the directory to the tnsnames.ora file
Well, on a whim, I went to changing everything in my setup to match an windows 2003 server that i had setup with instant client before. The main changes were putting the instant client in a folder at the root of the drive (not program files/oracle/etc), but c:/oracle, i know ive seen other posts saying that oracle was particular about characters in the directory path, maybe spaces are a no-no too?
I also add a bunch more environmental variables, anythign that was on the other machine, ORACLE_HOME (to root of instance), SQL_PATH (same), and added the root of the directory to the PATH system variable, not just the folder with the instantclient files. Anyways, I'm happy its working, anyone one of these changes could have been it though-
You may use ProcessMonitor and look at what your sqlplus process is doing. In my case TNS_ADMIN was correctly defined but, by mistake, my tnsnames.ora and sqlnet.ora had a stupid ".txt" extension, added by default by notepad when I created those files. And because "Windows Explorer" has the "Hide extensions for known file types" option set by default, the naming error wasn't obvious at all.
I installed the 12.1 instant client. For me, the problem was solved by creating \network\admin\tnsnames.ora file. Here's the PowerShell I used:
$source = "C:\Users\USER1\Desktop\tnsnames.ora"
$target = "C:\oracle\product\12.1.0\client_1\network\admin"
mkdir $target
copy-item $source $target