1

I have written a program which works fine, but when I run it as service it cannot create or write files and folders.

My program creates folder in my home directory and in that folder creates file for storing information incoming via TCP socket.

I do use User & Group in my .service but its only creating the folder without any permissions and fails to create a file.

Your help will be appreciated.

Greg
  • 189

1 Answers1

0

I fixed the problem by correct umask setting in my code.

Clarification: I had a problem creating files or folders and I assumed that the problem originates from the fact that my server program is systemd service but later I found out that I used umask erroneously:

umask(0755); <- bad

umask(0022); <- solved my problem
Greg
  • 189