It's my first time then I build a program into the SNAP package. I want to make my program more accessible.
The build is going without problems.
But libqtnetwor5 not see a couple needed libraries. Right here below you can see description of all logs and configurations.
The project tree:
tree
.
├── bin
│ └── ProjectTimer
├── setup
│ └── gui
│ └── icon.png
├── snapcraft.yaml
└── timerproject_1.0_amd64.snap
3 directories, 4 files
snapcraft.yaml
name: timerproject
version: "1.0"
summary: timer
description: |
Application for time-management
confinement: strict
architectures: [amd64]
apps:
timerproject:
command: desktop-launch ProjectTimer
plugs: ['home', 'unity7', 'x11', 'network']
parts:
timerproject:
plugin: copy
files:
bin/ProjectTimer : usr/bin/ProjectTimer
setup/gui/icon.png : usr/share/icons/timer.ico
integration:
plugin: nil
stage-packages:
- libc-bin
- libqt5network5
after: [desktop/qt5]
ldd ProjectTimer shows all libreries that the program need:
ldd bin/ProjectTimer
linux-vdso.so.1 => (0x00007fff1f1fc000)
libQt5QuickControls2.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5QuickControls2.so.5 (0x00007f5d2ad62000)
libQt5Quick.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Quick.so.5 (0x00007f5d2a772000)
libQt5Widgets.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5 (0x00007f5d29f22000)
libQt5Gui.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Gui.so.5 (0x00007f5d2977a000)
libQt5Qml.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Qml.so.5 (0x00007f5d2917a000)
libQt5Core.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5 (0x00007f5d28a5a000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5d286b2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5d2849a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5d280ca000)
libQt5Network.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Network.so.5 (0x00007f5d27d6a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5d27b4a000)
libQt5QuickTemplates2.so.5 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5QuickTemplates2.so.5 (0x00007f5d27882000)
libGL.so.1 => /usr/lib/nvidia-361/libGL.so.1 (0x00007f5d275f2000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5d272e2000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5d270c2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f5d26eba000)
/lib64/ld-linux-x86-64.so.2 (0x0000562df3108000)
libicui18n.so.56 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56 (0x00007f5d26a1a000)
libicuuc.so.56 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56 (0x00007f5d26662000)
libicudata.so.56 => /media/free/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56 (0x00007f5d24c7a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5d24a72000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f5d2486a000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f5d24552000)
libGLX.so.0 => /usr/lib/nvidia-361/libGLX.so.0 (0x00007f5d2431a000)
libGLdispatch.so.0 => /usr/lib/nvidia-361/libGLdispatch.so.0 (0x00007f5d24032000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f5d23dc2000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f5d23a82000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f5d2386a000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f5d23642000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f5d2343a000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f5d23232000)
If I start to program, I see message:
timerproject
ProjectTimer: /snap/timerproject/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version Qt_5' not found
(required by /snap/timerproject/x1/media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Quick.so.5)
ProjectTimer: /snap/timerproject/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: versionQt_5' not found
(required by /snap/timerproject/x1/media/free/Qt5.7.0/5.7/gcc_64/lib/libQt5Qml.so.5)
This is libraries for SNAP package:
ls -l /snap/timerproject/x1/media/free/Qt5.7.0/5.7/gcc_64/lib
-rwxr-xr-x 1 root root 25047100 янв 28 2016 libicudata.so.56
-rwxr-xr-x 1 root root 3374854 янв 28 2016 libicui18n.so.56
-rwxr-xr-x 1 root root 2070162 янв 28 2016 libicuuc.so.56
-rwxr-xr-x 1 root root 5339752 июл 30 16:45 libQt5Core.so.5
-rwxr-xr-x 1 root root 5909528 июн 10 12:10 libQt5Gui.so.5
-rwxr-xr-x 1 root root 4156520 июн 11 17:18 libQt5Qml.so.5
-rwxr-xr-x 1 root root 78696 июн 13 00:46 libQt5QuickControls2.so.5
-rwxr-xr-x 1 root root 4125768 июн 11 17:18 libQt5Quick.so.5
-rwxr-xr-x 1 root root 807600 июн 13 00:46 libQt5QuickTemplates2.so.5
-rwxr-xr-x 1 root root 6614408 июн 10 12:10 libQt5Widgets.so.5
My system have in standard libraries Qt:
ls -l /usr/lib/x86_64-linux-gnu/libQt5*
-rw-r--r-- 1 root root 1014 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5Core.prl
lrwxrwxrwx 1 root root 19 май 2 15:39 /usr/lib/x86_64-linux-gnu/libQt5Core.so -> libQt5Core.so.5.5.1
lrwxrwxrwx 1 root root 19 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 -> libQt5Core.so.5.5.1
lrwxrwxrwx 1 root root 19 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5 -> libQt5Core.so.5.5.1
-rw-r--r-- 1 root root 5052920 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1
-rw-r--r-- 1 root root 1008 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5DBus.prl
lrwxrwxrwx 1 root root 19 май 2 15:39 /usr/lib/x86_64-linux-gnu/libQt5DBus.so -> libQt5DBus.so.5.5.1
lrwxrwxrwx 1 root root 19 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 -> libQt5DBus.so.5.5.1
lrwxrwxrwx 1 root root 19 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5.5 -> libQt5DBus.so.5.5.1
-rw-r--r-- 1 root root 509456 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5.5.1
lrwxrwxrwx 1 root root 23 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Feedback.so.5 -> libQt5Feedback.so.5.0.0
lrwxrwxrwx 1 root root 23 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Feedback.so.5.0 -> libQt5Feedback.so.5.0.0
-rw-r--r-- 1 root root 52144 мар 14 14:20 /usr/lib/x86_64-linux-gnu/libQt5Feedback.so.5.0.0
-rw-r--r-- 1 root root 1039 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5Gui.prl
lrwxrwxrwx 1 root root 18 май 2 15:39 /usr/lib/x86_64-linux-gnu/libQt5Gui.so -> libQt5Gui.so.5.5.1
lrwxrwxrwx 1 root root 18 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 -> libQt5Gui.so.5.5.1
lrwxrwxrwx 1 root root 18 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5 -> libQt5Gui.so.5.5.1
-rw-r--r-- 1 root root 5514016 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1
-rw-r--r-- 1 root root 1002 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5Network.prl
lrwxrwxrwx 1 root root 22 май 2 15:39 /usr/lib/x86_64-linux-gnu/libQt5Network.so -> libQt5Network.so.5.5.1
lrwxrwxrwx 1 root root 22 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Network.so.5 -> libQt5Network.so.5.5.1
lrwxrwxrwx 1 root root 22 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Network.so.5.5 -> libQt5Network.so.5.5.1
-rw-r--r-- 1 root root 1412480 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5Network.so.5.5.1
-rw-r--r-- 1 root root 1266500 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5OpenGLExtensions.a
-rw-r--r-- 1 root root 1056 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5OpenGLExtensions.prl
lrwxrwxrwx 1 root root 21 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 -> libQt5OpenGL.so.5.5.1
lrwxrwxrwx 1 root root 21 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5 -> libQt5OpenGL.so.5.5.1
-rw-r--r-- 1 root root 362752 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.5.1
lrwxrwxrwx 1 root root 18 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 -> libQt5Qml.so.5.5.1
lrwxrwxrwx 1 root root 18 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5.5 -> libQt5Qml.so.5.5.1
-rw-r--r-- 1 root root 4358744 апр 12 13:00 /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5.5.1
lrwxrwxrwx 1 root root 20 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5 -> libQt5Quick.so.5.5.1
lrwxrwxrwx 1 root root 20 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.5 -> libQt5Quick.so.5.5.1
-rw-r--r-- 1 root root 3991248 апр 12 13:00 /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.5.1
lrwxrwxrwx 1 root root 24 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5 -> libQt5QuickTest.so.5.5.1
lrwxrwxrwx 1 root root 24 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5.5 -> libQt5QuickTest.so.5.5.1
-rw-r--r-- 1 root root 119232 апр 12 13:00 /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5.5.1
lrwxrwxrwx 1 root root 21 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5WebKit.so.5 -> libQt5WebKit.so.5.5.1
lrwxrwxrwx 1 root root 21 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5WebKit.so.5.5 -> libQt5WebKit.so.5.5.1
-rw-r--r-- 1 root root 37857816 ноя 30 2015 /usr/lib/x86_64-linux-gnu/libQt5WebKit.so.5.5.1
lrwxrwxrwx 1 root root 28 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5 -> libQt5WebKitWidgets.so.5.5.1
lrwxrwxrwx 1 root root 28 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5.5 -> libQt5WebKitWidgets.so.5.5.1
-rw-r--r-- 1 root root 282016 ноя 30 2015 /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5.5.1
-rw-r--r-- 1 root root 1059 май 2 15:37 /usr/lib/x86_64-linux-gnu/libQt5Widgets.prl
lrwxrwxrwx 1 root root 22 май 2 15:39 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so -> libQt5Widgets.so.5.5.1
lrwxrwxrwx 1 root root 22 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 -> libQt5Widgets.so.5.5.1
lrwxrwxrwx 1 root root 22 июл 29 22:58 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5 -> libQt5Widgets.so.5.5.1
-rw-r--r-- 1 root root 6861328 май 2 15:41 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
Maybe someone can understand where is the error? Or maybe someone can tell me how better to deal with libraries (my project not used a system libraries)
And last question, but not least does someone know how to build Qt projects like this?
The problem is that you're mixing Qt libraries from your own build and from your distribution (presumably, Ubuntu). The binary you're building depends on one Qt library (which you get from your own Qt build) and that one in turn depends on another Qt library that you get from Ubuntu. So the solution to this problem is to use only one source for Qt libraries.
I'd probably go for distribution libraries, unless there are some very specific reasons for using your own. To do it this way you need to fix your binary compilation (there are not enough details about it at the moment) to not link with your libraries (-I and -L flags, -rpath and similar things), everything else should be done automatically.
To package your own libraries you need to build them with -rpath flag so that dependencies for one library would also be resolved in your libraries directory. From what I see, snapcraft should be able to pick them in this case.
Related
The logs for my cron job show the following:
Your "cron" job on
produced the following output:
mv: cannot access *SRP*
mv: cannot access 0001LO928365.CSE
...
and so on.
But the files did actually move to the desired location.
What might be causing this error? Any help is appreciated!
Apologies - I figured this one out.
The move command is looking for different file types and moving all types. Even if the file is present, the command outputs an error stating file not found.
See testing details below:
root#abcd-abcdef:~/movetest/out# ls -lrt
total 5
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile1.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile2.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile3.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile4.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile5.CSE
root#abcd-abcdef:~/movetest/out# cd ../archive
root#abcd-abcdef:~/movetest/archive# ls -lrt
total 0
root#abcd-abcdef:~/movetest/archive# cd -
/home/specuser/movetest/out
root#abcd-abcdef:~/movetest/out# mv *.SRP* *.CSE* *SRP* *CSE* *.xml* ../archive/
mv: cannot access *.SRP*
mv: cannot access *SRP*
mv: cannot access testfile1.CSE
mv: cannot access testfile2.CSE
mv: cannot access testfile3.CSE
mv: cannot access testfile4.CSE
mv: cannot access testfile5.CSE
mv: cannot access *.xml*
root#abcd-abcdef:~/movetest/out# ls -lrt
total 0
root#abcd-abcdef:~/movetest/out# cd -
/home/specuser/movetest/archive
root#abcd-abcdef:~/movetest/archive# ls -lrt
total 5
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile1.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile2.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile3.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile4.CSE
-rw-r--r-- 1 root root 0 Aug 20 13:53 testfile5.CSE
root#abcd-abcdef:~/movetest/archive#*
I'm trying to understand the purpose of the --file-type argument of the UNIX ls command.
I didn't find any example using ls --file-type on the web – neither was I able to make sense of the --file-type argument by issuing ls --file-type myself.
What's the purpose of ls --file-type? Would anyone please give me a helpful example of ls --file-type making the purpose of this argument more clear to me?
Quoting from info ls:
-F
Append a character to each file name indicating the file type.
Also, for regular files that are executable, append *. The file
type indicators are / for directories, # for symbolic links,
| for FIFOs, = for sockets, > for doors, and nothing for
regular files.
--file-type is just like -F, except that it doesn't append * for executable files:
$ ln -s /etc/passwd foo
$ touch bar; chmod +x bar
$ ls
foo bar
$ ls -F
foo# bar*
$ ls --file-type
foo# bar
...
...
The --file-type option is similar to the -F option.
-F, --classify
append indicator (one of */=>#|) to entries
--file-type
likewise, except do not append `*'
Source.
Here's an example of ls --file-tye /
bin# boot/ dev/ etc/ home/ lib# lib64# lost+found/ media/ mnt/ opt/ proc/ root/ run/ sbin# srv/ sys/ tmp/ usr/ var/
as compared to the output of ls -l /
lrwxrwxrwx 1 root root 7 Jan 19 02:32 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Jan 1 1970 boot
drwxr-xr-x 24 root root 4220 Mar 26 19:56 dev
drwxr-xr-x 88 root root 4096 Mar 26 21:15 etc
drwxr-xr-x 4 root root 4096 Apr 5 2020 home
lrwxrwxrwx 1 root root 7 Jan 19 02:32 lib -> usr/lib
lrwxrwxrwx 1 root root 7 Jan 19 02:32 lib64 -> usr/lib
drwx------ 2 root root 16384 Apr 5 2020 lost+found
drwxr-xr-x 2 root root 4096 Dec 11 20:19 media
drwxr-xr-x 7 root root 4096 Sep 8 2020 mnt
drwxr-xr-x 9 root root 4096 Feb 9 13:58 opt
dr-xr-xr-x 335 root root 0 Mar 26 19:56 proc
drwxr-x--- 9 root root 4096 Feb 11 13:18 root
drwxr-xr-x 28 root root 700 Mar 26 21:15 run
lrwxrwxrwx 1 root root 7 Jan 19 02:32 sbin -> usr/bin
drwxr-xr-x 4 root root 4096 Apr 5 2020 srv
dr-xr-xr-x 13 root root 0 Mar 26 19:56 sys
drwxrwxrwt 12 root root 320 Mar 26 22:11 tmp
drwxr-xr-x 9 root root 4096 Mar 25 11:06 usr
drwxr-xr-x 12 root root 4096 Mar 25 11:07 var
As you see the symbol "#" indicates symbolic-links (l). Directories (d) and regular files (f) are not flagged by the --file-type argument.
Issuing ls --file-type in my home directory is identical to ls ~ since it only contains directories and regular files and hence the output of the former doesn't contain any indicators.
See also the answer of PesaThe for a full list of the indicator symbols.
I would like to rename all files in a folder based on a text file (list.txt) with two columns: oldnam (which represents the current name) and newnam (which contains the required new name).
My text file:
df <- "oldnam newnam
TRTY_3.DOT 124325.DOT
TRTY_4.DOT 123454.DOT
TRTY_5.DOT 124355.DOT"
df <- read.table(text=df, header=T)
write.table(df, "list.txt", col.names=T, row.names=F, quote=F)
It is possible to do it from R or directly in bash (both solutions could help a lot)?
First list the files in your folder
file.list <- list.files(yourfolderpath, pattern="\\.DOT$", full.names=TRUE)
Then use file.rename to rename files based on your list.txt file.
file.rename(from = file.path(dirname(file.list), list.txt$oldnam), to = file.path(dirname(file.list), list.txt$newnam))
initial files in folder
ll
total 8
-rw-r--r-- 1 root root 0 Jan 15 18:01 1.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 2.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 3.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 4.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 5.txt
-rw-r--r-- 1 root root 40 Jan 15 18:01 files
-rwxr-xr-x 1 root root 272 Jan 15 18:10 script.sh
list of files
cat files
1.txt 11.txt
2.txt 22.txt
3.txt 33.txt
running the script
./script.sh files
root#xx:~#
files in folder after running script
ll
total 8
-rw-r--r-- 1 root root 0 Jan 15 18:01 11.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 22.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 33.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 4.txt
-rw-r--r-- 1 root root 0 Jan 15 18:01 5.txt
-rw-r--r-- 1 root root 40 Jan 15 18:01 files
-rwxr-xr-x 1 root root 270 Jan 15 18:11 script.sh
the script
cat script.sh
#!/bin/bash
filename="$1"
folder_with_files=/root/
while read -r line
do
oldname=$(echo "$line" | awk '{print $1}')
newname=$(echo "$line" | awk '{print $2}')
[ -z "$oldname" ] && { break ; }
mv $folder_with_files$oldname $folder_with_files$newname
done < "$filename"
after migrating from depreciated smtpd_recipient_restrictions to smtpd_relay_restrictions, outbound smtp hangs for users and these are the errors I find in the logs. "auxpropfunc error version mismatch with plug-in" and a "_sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql"
emailer1 saslfinger-1.0.3 # ./saslfinger -s
saslfinger - postfix Cyrus sasl configuration Fri Aug 30 00:48:43 UTC 2013
version: 1.0.2
mode: server-side SMTP AUTH
-- basics --
Postfix: 2.10.1
System: Gentoo Base System release 2.2
-- smtpd is linked to --
libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00007f262e22a000)
libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007f262d6cc000)
-- active SMTP AUTH and TLS parameters for smtpd --
broken_sasl_auth_clients = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/ssl/postfix/nyctelecomm.com.crt
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/postfix/nyctelecomm.com.crt
smtpd_tls_key_file = /etc/ssl/postfix/nyctelecomm.com.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
-- listing of /usr/lib64/sasl2 --
total 1180
drwxr-xr-x 2 root root 4096 Aug 11 20:29 .
drwxr-xr-x 43 root root 12288 Aug 28 18:22 ..
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so.3
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so.3.0.0
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so.3
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so.3.0.0
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so.3
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so.3.0.0
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so.3
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so.3.0.0
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so.3
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so.3.0.0
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so.3
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so.3.0.0
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so.3
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so.3.0.0
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so.3
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so.3.0.0
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so.3
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so.3.0.0
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so.3
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so.3.0.0
-- listing of /usr/lib/sasl2 --
total 1180
drwxr-xr-x 2 root root 4096 Aug 11 20:29 .
drwxr-xr-x 43 root root 12288 Aug 28 18:22 ..
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so.3
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 libanonymous.so.3.0.0
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so.3
-rwxr-xr-x 1 root root 22760 Aug 11 20:29 libcrammd5.so.3.0.0
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so.3
-rwxr-xr-x 1 root root 56040 Aug 11 20:29 libdigestmd5.so.3.0.0
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so.3
-rwxr-xr-x 1 root root 18632 Aug 11 20:29 liblogin.so.3.0.0
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so.3
-rwxr-xr-x 1 root root 35208 Aug 11 20:29 libntlm.so.3.0.0
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so.3
-rwxr-xr-x 1 root root 109056 Aug 11 20:29 libotp.so.3.0.0
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so.3
-rwxr-xr-x 1 root root 18664 Aug 11 20:29 libplain.so.3.0.0
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so.3
-rwxr-xr-x 1 root root 26800 Aug 11 20:29 libsasldb.so.3.0.0
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so.3
-rwxr-xr-x 1 root root 39208 Aug 11 20:29 libscram.so.3.0.0
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so.3
-rwxr-xr-x 1 root root 26816 Aug 11 20:29 libsql.so.3.0.0
-- listing of /etc/sasl2 --
total 32
drwxr-xr-x 2 root root 4096 Aug 11 20:29 .
drwxr-xr-x 58 root root 4096 Aug 29 05:12 ..
-rw-r--r-- 1 root root 147 Aug 9 02:08 ._cfg0000_smtpd.conf
-rw-r--r-- 1 root root 0 Aug 11 20:29 .keep_dev-libs_cyrus-sasl-2
-rw-r----- 1 root mail 12432 Aug 8 19:44 sasldb2
-rw-r--r-- 1 root root 405 Aug 10 07:39 smtpd.conf
-- content of /etc/sasl2/smtpd.conf --
pwcheck_method: authdaemond
mech_list: LOGIN PLAIN
authdaemon_path: /var/lib/courier/authdaemon/socket
log_level: 5
sasl_pwcheck_method: auxprop
sasl_auxprop_plugin: pgsql
password_format: crypt
mech_list: LOGIN PLAIN
sql_engine: pgsql
#sql_hostnames: localhost
sql_database: postfix
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_select: SELECT password FROM mailbox WHERE local_part='%u' AND active='1'
-- active services in /etc/postfix/master.cf --
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
smtp inet n - n - - smtpd
submission inet n - n - - smtpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
user1 unix - - n - - smtp
-o syslog_name=postfix-user1
-o smtp_bind_address6=2600:3c01:e000:44:0:0:0:10
-- mechanisms on localhost --
250-AUTH LOGIN PLAIN
-- end of saslfinger output --
******************************* postmap ************************************
emailer1 htdocs # postmap -q "info#nyctelecomm.com" pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf
info#nyctelecomm.com
emailer1 htdocs # postmap -q "nyctelecomm.com" pgsql:/etc/postfix/pgsql/virtual_mailbox_domains.cf
nyctelecomm
emailer1 htdocs # postmap -q "info#nyctelecomm.com" pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf
nyctelecomm.com/info/
********************************************* postconf ************************
emailer1 htdocs # postconf -n
broken_sasl_auth_clients = no
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 3
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
home_mailbox = .maildir/
html_directory = no
inet_protocols = ipv4, ipv6
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sender_dependent_default_transport_maps = hash:/etc/postfix/transport.cf
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_client_restrictions = permit_sasl_authenticated permit_mynetworks, check_client_access
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_sasl_authenticated permit_mynetworks, reject_unknown_helo_hostname, reject_invalid_helo_hostname
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks, permit_sasl_authenticated
smtpd_relay_restrictions = permit_sasl_authenticated permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = permit_sasl_authenticated reject_non_fqdn_sender, reject_unknown_sender_domain
smtpd_tls_CAfile = /etc/ssl/postfix/nyctelecomm.com.crt
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/postfix/nyctelecomm.com.crt
smtpd_tls_key_file = /etc/ssl/postfix/nyctelecomm.com.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = pgsql:/etc/postfix/pgsql/virtual_mailbox_domains.cf
virtual_mailbox_maps = pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf
virtual_uid_maps = static:5000
************************ error ***********************************
2013-08-28T23:06:57+00:00 emailer1 postfix/smtpd[21746]: auxpropfunc error version mismatch with plug-in
2013-08-28T23:06:57+00:00 emailer1 postfix/smtpd[21746]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sasldb
2013-08-28T23:06:57+00:00 emailer1 postfix/smtpd[21746]: auxpropfunc error version mismatch with plug-in
2013-08-28T23:06:57+00:00 emailer1 postfix/smtpd[21746]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin:
There was a stuck version in the libraries.
I emerge -C cyrus-sasl, then downgraded to an earlier version, I saw the collision overwrites occur, went back to the regular cyrus and the error went away.
Just wondering is there any way to create a temporary sandbox environment for running commands?
My requirement is that i am hosting a webservice in unix and i need to execute a commanline tool to return output to the webservice client. since i am passing the values received from the client to the commanline tool, i would like to execute the commands in sandboxed environment.
I'm not sure but, you can try to use the "chroot" command to create new "root" enviroment, for example,
If you have the directory structure and you want to "protect" the "license" file,
/
/etc
+ license
/bin
+ ls
/lib
+ ...
You can create a chroot enviroment as
itily#openzooey:~$ mkdir chroot_example
itily#openzooey:~$ cd chroot_example/
itily#openzooey:~/chroot_example$ mkdir -p usr/lib lib bin etc
itily#openzooey:~/chroot_example$ cd bin/
itily#openzooey:~/chroot_example/bin$ cp /bin/ls .
itily#openzooey:~/chroot_example/bin$ ldd ls
libsec.so.1 => /lib/libsec.so.1
libnvpair.so.1 => /lib/libnvpair.so.1
libcmdutils.so.1 => /lib/libcmdutils.so.1
libcurses.so.1 => /lib/libcurses.so.1
libc.so.1 => /lib/libc.so.1
libavl.so.1 => /lib/libavl.so.1
libidmap.so.1 => /usr/lib/libidmap.so.1
libnsl.so.1 => /lib/libnsl.so.1
libuutil.so.1 => /lib/libuutil.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libm.so.2 => /lib/libm.so.2
Now populate the "shared lib" required by the ls command (using the ldd we know which are the required shared libs
itily#openzooey:~/chroot_example/bin$ ldd ls |awk '{print "cp "$3" lib/"}'
cp /lib/libsec.so.1 lib/
cp /lib/libnvpair.so.1 lib/
cp /lib/libcmdutils.so.1 lib/
cp /lib/libcurses.so.1 lib/
cp /lib/libc.so.1 lib/
cp /lib/libavl.so.1 lib/
cp /usr/lib/libidmap.so.1 lib/
cp /lib/libnsl.so.1 lib/
cp /lib/libuutil.so.1 lib/
cp /lib/libmp.so.2 lib/
cp /lib/libmd.so.1 lib/
cp /lib/libm.so.2 lib/
Now we need to copy to our new "lib" and usr/lib directory
itily#openzooey:~/chroot_example/bin$ cd ..
itily#openzooey:~/chroot_example$ ldd /bin/ls |awk '{print "cp "$3" lib/"}'|bash
itily#openzooey:~/chroot_example$ ls -ltr
total 9
drwxr-xr-x 2 itily staff 2 dic 22 14:37 etc
drwxr-xr-x 2 itily staff 3 dic 22 14:37 bin
drwxr-xr-x 2 itily staff 14 dic 22 14:38 lib
itily#openzooey:~/chroot_example$ cp /usr/lib/libidmap.so.1 usr/lib/
itily#openzooey:~/chroot_example$ cp /usr/lib/ld.so.1 usr/lib/
itily#openzooey:~/chroot_example$ cd lib/
itily#openzooey:~/chroot_example/lib$ ls -l
total 7615
-rwxr-xr-x 1 itily staff 14044 dic 22 14:38 libavl.so.1
-rwxr-xr-x 1 itily staff 1721400 dic 22 14:38 libc.so.1
-rwxr-xr-x 1 itily staff 26748 dic 22 14:38 libcmdutils.so.1
-rwxr-xr-x 1 itily staff 293876 dic 22 14:38 libcurses.so.1
-rwxr-xr-x 1 itily staff 97852 dic 22 14:38 libidmap.so.1
-rwxr-xr-x 1 itily staff 398704 dic 22 14:38 libm.so.2
-rwxr-xr-x 1 itily staff 87164 dic 22 14:38 libmd.so.1
-rwxr-xr-x 1 itily staff 25140 dic 22 14:38 libmp.so.2
-rwxr-xr-x 1 itily staff 648776 dic 22 14:38 libnsl.so.1
-rwxr-xr-x 1 itily staff 74776 dic 22 14:38 libnvpair.so.1
-rwxr-xr-x 1 itily staff 97500 dic 22 14:38 libsec.so.1
-rwxr-xr-x 1 itily staff 49556 dic 22 14:38 libuutil.so.1
itily#openzooey:~/chroot_example/lib$ cd ..
So, the final structure is
itily#openzooey:~/chroot_example$ ls -l
total 12
drwxr-xr-x 2 itily staff 3 dic 22 14:37 bin
drwxr-xr-x 2 itily staff 5 ene 10 20:43 etc
drwxr-xr-x 2 itily staff 14 ene 10 20:48 lib
drwxr-xr-x 3 itily staff 3 ene 10 20:40 usr
Also you need the group, passwd and other files
itily#openzooey:~/chroot_example$ echo "this is a test" > etc/license
itily#openzooey:~/chroot_example$ cd etc/
itily#openzooey:~/chroot_example/etc$ cat /etc/group |grep staff > group
itily#openzooey:~/chroot_example/etc$ cat /etc/passwd |grep itily > passwd
Now you can run the chroot command, but if you try to run as non root you will get the error
itily#openzooey:~$ chroot chroot_example bin/ls /etc
chroot: cannot change root directory to chroot_example: Not owner
So, you need to run as root
itily#openzooey:~$ pfexec chroot chroot_example /bin/ls -l /etc
total 6
-rw-r--r-- 1 101 10 11 Jan 10 19:43 group
-rw-r--r-- 1 101 10 18 Jan 10 19:42 license
-rw-r--r-- 1 101 10 49 Jan 10 19:43 passwd
I hope it's what you are looking for ...
Urko,
You didn't say which Unix. Solaris zones do that easily. Here's an example how to set one up:
http://www.solarisinternals.com/wiki/index.php/Zones
I routinely develop in sandboxes in Debian Linux and like to use chroots so that I don't destroy my host machine in case I do something stupid by accident (which happens a lot). I put together a set of scripts for Debian and Ubuntu for me to create chroots (both cross-distro and x86 in x86-64) which you may find helpful.
https://github.com/vtonehundred/vroot