How to save file to 'usr/lib' directory? lazarus / 32-Linux ---------------------------------------------------------------------- Michael Collier · 2012-02-06 15:17 Hi, I can't seem to copy a library file "myDll.so" from my project directory over to the 'usr/lib' directory using the CopyFile command? I'm guessing maybe its a security issue, I can copy the file using terminal when using the "sudo cp" command and I can use CopyFile to copy the library to my home directory.. Can I get round this somehow programmatically? (The reason for doing this is so that after my library has compiled I use the project options to call my "CopyLibrary" program which copies the library into '/usr/lib' or 'C:\windows\system32') ---------------------------------------------------------------------- BigChimp · 2012-02-06 15:25 That does sound like a permissions issue. See the wiki (article on executing external programs). A more elegant way of doing things would be to write/use an installer (e.g. .deb or .rpm for Linux), Inno Setup for windows. Also note that nowadays a lot of dlls in Windows can just be placed in the application directory. Yes, that does negate the "shared" part of dlls but it lessens "DLL Hell" problems... ---------------------------------------------------------------------- Michael Collier · 2012-02-06 15:31 Thanks I'll try and find the article, I do use installers for the dll (at project distribution stage) but copying the file into the system folders immediatley after compilation make life easier for me, I have several applications written in different languages that access the dll so copying into different project folders wouldn't help in this case. ---------------------------------------------------------------------- chrnobel · 2012-02-06 22:20 /usr/lib requires root privileges to write in, and the CopyFile has the same privileges as the program in which you use the command, meaning that you have to run your program as root (with all the risk that can cause). ---------------------------------------------------------------------- BigChimp · 2012-02-07 06:16 Wiki link: http://wiki.lazarus.freepascal.org/Executing_External_Progr ams#Redirecting_input_and_output_and_running_under_root that links to a forum thread with a way to use policykit http://lazarus.freepascal.org/index.php/topic,14479.0.html ---------------------------------------------------------------------- TurboRascal · 2012-02-07 21:09 Unless you use Slackware or a similar distribution which has no package management system, you shouldn't write any files to /usr/lib and other system lib and bin directories. If you need to do that, do it under the /usr/local tree; in this case that would be /usr/local/lib. If you wish to write to that directory often, you may give yourself (or a group where you're in) write permissions (although that creates a bit of a security weakness). You should NOT do that to /usr/lib though!