How to create a linux user using C/C++?

后端 未结 3 1152
半阙折子戏
半阙折子戏 2020-12-10 16:20

I would like to build a program which takes a username as parameter and creates the user and its home folder (with some hard-coded specifications like folde

3条回答
  •  一个人的身影
    2020-12-10 16:31

    Probably your best bet is to invoke useradd; it will do the right things (given appropriate parameters).

    Trying to create one manually by calling the appropriate APIs is possible but not desirable.

提交回复
热议问题