LFTP mirror access fails for existing remote folder - ftp

I am trying to use LFTP to mirror a remote FTP running on Windows (that's all I know about the configuration of it. Also, I just have reading access)
I'm running the following shell script:
#!/bin/bash
HOST='omitted'
USER='omitted'
PASS='omitted'
LOCALFOLDER="omitted"
REMOTEFOLDER="/Initial data/Practice area/Intellectual Property/"
lftp -f "
debug -o debug.text 9
open $HOST
user $USER $PASS
cd '$REMOTEFOLDER'
ls
mirror --reverse --verbose '$REMOTEFOLDER' '$LOCALFOLDER'
bye
"
After running it, I get the following output:
source: Is a directory
drwxr-xr-x 1 ftp ftp 0 Mar 23 2017 03.17.17
drwxr-xr-x 1 ftp ftp 0 Nov 05 2016 2016.10.03
drwxr-xr-x 1 ftp ftp 0 Nov 05 2016 2016.10.07
drwxr-xr-x 1 ftp ftp 0 Feb 23 2017 2017.02.21
drwxr-xr-x 1 ftp ftp 0 Feb 26 2017 2017.02.24
drwxr-xr-x 1 ftp ftp 0 Mar 02 2017 2017.02.27
drwxr-xr-x 1 ftp ftp 0 Apr 11 2017 2017.03.17
drwxr-xr-x 1 ftp ftp 0 Mar 28 2017 2017.03.27
drwxr-xr-x 1 ftp ftp 0 Apr 04 2017 2017.03.31
drwxr-xr-x 1 ftp ftp 0 Aug 09 08:34 2017.04.06
drwxr-xr-x 1 ftp ftp 0 Jun 07 2017 2017.05.31
drwxr-xr-x 1 ftp ftp 0 Jul 17 10:52 2017.07.17
drwxr-xr-x 1 ftp ftp 0 Feb 19 2017 New Folder
mirror: Access failed: /Initial data/Practice area/Intellectual Property: No such file or directory
As you can see, I can list all files inside of the folder that I want to mirror but the mirror command fails.
And following is the debug output:
---- Resolving host address...
---- 1 address found: <omitted>
---- Connecting to <omitted> (<omitted>) port <omitted>
<--- 220 Welcome to <omitted>
---> FEAT
<--- 211-Features:
<--- MDTM
<--- REST STREAM
<--- SIZE
<--- MLST type*;size*;modify*;
<--- MLSD
<--- UTF8
<--- CLNT
<--- MFMT
<--- 211 End
---> CLNT lftp/4.6.3a
<--- 200 Don't care
---> OPTS UTF8 ON
<--- 530 Please log in with USER and PASS first.
---> USER <omitted>
<--- 331 Password required for <omitted>
---> PASS <omitted>
<--- 230 Logged on
---> CLNT lftp/4.6.3a
<--- 200 Don't care
---> OPTS UTF8 ON
<--- 200 UTF8 mode enabled
---> PWD
<--- 257 "/" is current directory.
---- CWD path to be sent is `/Initial data/Practice area/Intellectual Property'
---> CWD Initial data
<--- 250 CWD successful. "/Initial data" is current directory.
---> CWD Practice area
<--- 250 CWD successful. "/Initial data/Practice area" is current directory.
---> CWD Intellectual Property
<--- 250 CWD successful. "/Initial data/Practice area/Intellectual Property" is current directory.
---> PASV
<--- 227 Entering Passive Mode (<omitted>)
---- Connecting data socket to (<omitted>) port <omitted>
---- Data connection established
---> LIST
<--- 150 Connection accepted
---- Got EOF on data connection
---- Closing data socket
<--- 226 Transfer OK
**** /Initial data/Practice area/Intellectual Property: No such file or directory
---> QUIT
<--- 221 Goodbye
---- Closing control socket
I really appreciate if you have any idea of what's wrong :)
Thanks,

Remove the --reverse option which is for uploading to the server.

Related

Writing to a mounted Windows share

I am using Ubunutu 20.04 and I am trying to write to a mounted Windows share. This is the command I am using to mount the share:
sudo mount.cifs //192.168.1.5/tv /mnt/tv -o username=xxxxxxxxxx,password=xxxxxxxxx,file_mode=0777,dir_mode=0777
I am able to view the contents of the Windows share in Ubuntu:
darren#homeserver:~$ ls -l /mnt/tv/
total 0
drwxrwxrwx 2 root root 0 Jun 30 15:33 '$RECYCLE.BIN'
drwxrwxrwx 2 root root 0 Jan 1 2019 MSOCache
drwxrwxrwx 2 root root 0 Apr 28 00:38 'Plex dance'
drwxrwxrwx 2 root root 0 Dec 30 2019 'System Volume Information'
drwxrwxrwx 2 root root 0 Jun 24 15:37 'TV Shows'
-rwxrwxrwx 1 root root 0 Jan 1 2019 desktop.ini
But if I try to create a test file i get this error:
[ Error writing lock file /mnt/tv/.test.swp: Permission denied ]
I have the Windows share permissions set to "Everyone":
Any thoughts?
Try this configuration:
-fstype=cifs,credentials=<fileWithCred>,vers=3.0,dir_mode=0777,file_mode=0777,noserverino ://<IP-Winshare>/Path

Why does directory vanish when I do SSHFS? How to setup SSHFS share on Max OSX 10.9?

I'm running Max OSX 10.9.3 and I'm trying to setup an SSHFS file-share between my MacBook Pro and a remote file system. However, when I try to do it, it doesn't work.
Strangely enough, it makes the target directory disappear. Has anyone else seen this happen? Is it a bug?
First see that I can ssh normally into the target machine:
% ssh remoteuser#XXX.XXX.XXX.XXX # <--- SSH to remote system works! See below.
remoteuser#XXX.XXX.XXX.XXX % ls -altr remoteDir
total 8
drwxr-xr-x 26 remoteuser remoteuser 4096 Jun 22 01:00 ..
drwxrwxrwx 2 remoteuser remoteuser 4096 Jun 22 01:08 .
remoteuser#XXX.XXX.XXX.XXX % exit
% # <--- Logged out of remote system
Next, I create a directory locally and verify it was created:
% pwd
/mnt
% ls
total 0
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 2 root admin 68 Jun 23 08:11 ./
% sudo mkdir share1
% ls
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 4 root admin 136 Jun 23 08:50 ./
drwxr-xr-x 2 root admin 68 Jun 23 08:50 share/
Now I try to setup the SSHFS share:
% sudo sshfs remoteuser#XXX.XXX.XXX.XXX:remoteDir /mnt/share1
remoteuser#XXX.XXX.XXX.XXX's password:
%
Ok. It seems to have worked. No errors. So let's see the share we created, shall we?
% ls
ls: share1: No such file or directory
total 0
drwxr-xr-x 31 root admin 1122 Jun 18 18:34 ../
drwxr-xr-x 3 root admin 102 Jun 23 08:12 ./
What? Not only is the File Sharing not working, but the share1 directory seems to have vanished! (Although the file system seems to know it is missing, which is weird).
Where did /mnt/share1 go and how do I setup this SSHFS?
SSHFS doesn't come with OS X AFAIK, so you should mention how you installed it. But I'm guessing sshfs is designed to be used with fstab or mount rather than be called directly. Try something like:
mount -t sshfs remoteuser#XXX.XXX.XXX.XXX:remoteDir /mnt/share1

cd command does not see the directory in bash

I have the following bash script:
#!/bin/bash
run_python(){
cd "`dirname $1`"
python "`basename $1`" $2 >test.log
}
crypto_util=/home/dev/src/crypto/util.py
run_python $crypto_util "testpassword"
Somehow cd command fails saying:
cd: /home/dev/src/crypto No such file or directory. I am quite sure the directory exists.
On a side note if I do the following this fails too:
run_python(){
python "$1" $2 >test.log
}
Saying python can not open the file /home/dev/src/crypto/util.py because there is no such file.
Any idea why?
Here is the output of the ll command on the directory/file:
drwxr--r--. 2 dev root 4096 Jun 11 18:56 crypto
-rwxr--r--. 1 dev root 4934 Jun 9 10:50 util.py
Output of ls -llid /home/
654084 drwxr-xr-x. 4 root root 4096 May 8 10:52 /home
Output of ls -lid /home/dev/
924265 drwxr--r--. 4 dev root 4096 Jun 9 09:17 /home/dev/
Output of ls -lid/home/dev/src/:
924266 drwxr--r--. 9 dev root 4096 Jun 9 10:01 /home/dev/src/
Output of ls -lid/home/dev/src/crypto:
924333 drwxr--r--. 2 dev root 4096 Jun 11 18:56 /home/dev/src/crypto/
Output of ls -lid/home/dev/src/crypto/util.py:
924337 -rwxr--r--. 1 dev root 4934 Jun 9 10:50 /home/dev/src/crypto/util.py
some of those dirs don't have x permission bit set - those are needed for entering a directory. Your problem may be that your scripts are running with another user as owner than "dev". dev is the only user allowed to change to those directories.
Set the dirs to +x, and try again.

Oracle concurrent program cannot write to directory

We have an Oracle EBS concurrent program, ran as applmgr, that needs to load data using SQL*Loader, and move the input data to an archive location:
sqlldr $w_login \
control=$w_directory/$w_ctrl \
data=$w_directory/$w_data \
log=$w_directory/log/$w_data.log
[[ -f $w_directory/log/$w_data.log ]] && \
mv $w_directory/$w_data $w_directory/archive/$w_data.archive
However, it fails in the mv part:
34 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
mv: cannot move `/w_directory/w_data.dat' to `/w_directory/archive/w_data.dat.archive': Permission denied
The applmgr user has write permissions on the directories and file:
drwxrwxr-x 14 otheruser othergroup 4096 Apr 16 2012 /w_directory
drwxrwxr-x 14 otheruser othergroup 4096 Apr 16 2012 /w_directory/log
drwxrwxr-x 14 otheruser othergroup 4096 Apr 16 2012 /w_directory/archive
-rwxrwxr-x 14 otheruser othergroup 4096 Apr 16 2012 /w_directory/w_data.dat
$ id applmgr
uid=1003(applmgr) gid=1000(dba) groups=1000(dba),1003(othergroup)
We can run the above program manually, through the command-line as applmgr, without any issues. But it fails with the above error when ran as a concurrent program. We have already bounced the server as well.
The server is on RHEL 6.4. Oracle EBS is R12.1.3.

error: unable to open /dev/null for stdin: No such file or directory

I cannot get a simple trigger on proftpd working. Here is what I did:
<IfModule mod_exec.c>
ExecEngine on
ExecOptions logStderr logStdout
ExecLog /var/log/proftpd/exec.log
ExecOnCommand APPE,STOR /usr/local/bin/proftptest.sh %u %f
</IfModule>
however it keeps on failing with:
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: preparing to execute '/usr/local/bin/proftptest.sh' with uid 117 (euid 117), gid 65534 (egid 65534)
Jan 21 17:31:07 mod_exec/0.9.9[22514]: + '/usr/local/bin/proftptest.sh': argv[1] = ftp
Jan 21 17:31:07 mod_exec/0.9.9[22514]: + '/usr/local/bin/proftptest.sh': argv[2] = /home/ftp/incoming/Examples.txt
Jan 21 17:31:07 mod_exec/0.9.9[22514]: error: unable to open /dev/null for stdin: No such file or directory
Jan 21 17:31:07 mod_exec/0.9.9[22514]: STOR ExecOnCommand '/usr/local/bin/proftptest.sh' failed: No such file or directory
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
However the script seems fine (running from my user session, default env):
$ ls -al /usr/local/bin/proftptest.sh
-rwxr-xr-x 1 root root 97 Jan 21 17:25 /usr/local/bin/proftptest.sh
I am NOT using DefaultRoot:
$ grep Default /etc/proftpd/proftpd.conf
DefaultServer on
# DefaultRoot ~
What could I possibly be missing ?
As expained in the documentation:
http://www.castaglia.org/proftpd/modules/mod_exec.html#Usage
This module will not work properly for <Anonymous> logins
This document the symptoms, but does not solve the real issue, so moving on to a different ftp server...

Resources