1

I can normaly mount/umount FTP as file system using following commands:

└──> curlftpfs -o codepage=windows-1250 anonymous:anonymous@192.168.3.13 /home/marek/ftpfs
└──> ls /home/marek/ftpfs/
1 2 3
└──> fusermount -u /home/marek/ftpfs
└──> ls /home/marek/ftpfs/
└──>

But when I issue curlftpfs with strace then nothing is mounted and the process exits with status 1:

└──> strace -f curlftpfs -o codepage=windows-1250 anonymous:anonymous@192.168.3.13 /home/marek/ftpfs
└──> echo $0
1
└──> ls /home/marek/ftpfs/
└──>

Last lines from strace (full output is here):

[pid  9619] mprotect(0x7f08780b2000, 4096, PROT_READ) = 0
[pid  9619] mprotect(0x7f08782bd000, 4096, PROT_READ) = 0
[pid  9619] munmap(0x7f0878e8d000, 135950) = 0
[pid  9619] open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 6
[pid  9619] lseek(6, 0, SEEK_CUR)       = 0
[pid  9619] fstat(6, {st_mode=S_IFREG|0644, st_size=2290, ...}) = 0
[pid  9619] mmap(NULL, 2290, PROT_READ, MAP_SHARED, 6, 0) = 0x7f0878eae000
[pid  9619] lseek(6, 2290, SEEK_SET)    = 2290
[pid  9619] munmap(0x7f0878eae000, 2290) = 0
[pid  9619] close(6)                    = 0
[pid  9619] getgid()                    = 1000
[pid  9619] getuid()                    = 1000
[pid  9619] openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 6
[pid  9619] getdents(6, /* 2 entries */, 32768) = 48
[pid  9619] getdents(6, /* 0 entries */, 32768) = 0
[pid  9619] close(6)                    = 0
[pid  9619] mount("curlftpfs#ftp://anonymous:anonymous@192.168.3.13/", ".", "fuse", MS_NOSUID|MS_NODEV, "fd=3,rootmode=40000,user_id=1000"...) = -1 EPERM (Operation not permitted)
[pid  9619] write(2, "fusermount: mount failed: Operat"..., 50fusermount: mount failed: Operation not permitted
) = 50
[pid  9619] close(3)                    = 0
[pid  9619] exit_group(1)               = ?
[pid  9618] <... recvmsg resumed> {msg_name(0)=NULL, msg_iov(1)=[{"", 1}], msg_controllen=0, msg_flags=0}, 0) = 0
[pid  9618] close(6)                    = 0
[pid  9618] wait4(9619,  <unfinished ...>
[pid  9619] +++ exited with 1 +++
<... wait4 resumed> NULL, 0, NULL)      = 9619
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9619, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
sendto(4, "QUIT\r\n", 6, MSG_NOSIGNAL, NULL, 0) = 6
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 1 ([{fd=4, revents=POLLIN|POLLRDNORM}])
recvfrom(4, "221 Bye\r\n", 16384, 0, NULL, NULL) = 9
close(4)                                = 0
close(3)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
3

I am not familiar with this executable, but my guess is that it needs to run with privilege (probably suid root or similar). strace -f cannot run such a process with privilege unless strace itself is run as root and you may need the -u option.

5
  • Exactly, this does the trick sudo strace -u marek curlftpfs -o codepage=windows-1250 anonymous:anonymous@192.168.3.13 /home/marek/ftpfs thank you Feb 16 '16 at 10:49
  • @RuiFRibeiro pardon me but what does this to do with my problem? Feb 16 '16 at 10:55
  • @WakanTanka I read status, never mind. Feb 16 '16 at 10:57
  • @BarefootIO I've now find that there is no SUID bit set on this binary: -rwxr-xr-x 1 root root 57640 Aug 17 2015 /usr/bin/curlftpfs isn't this strange? Feb 16 '16 at 11:03
  • @WakanTanka: Again, I've never used these tools, but it seems that curlftpfs uses libfuse which then appears to fork/exec a helper named fusermount. This helper is what actually manages the actual mounting and unmounting. Your trace confirms this. Line 401 execs it without privilege and this is the pid that later fails with EPERM at Line 562. Feb 16 '16 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.