How to add, delete edit username from /etc/passwd

2020-04-10 03:16发布

I want to add or delete or edit usernames of /etc/passwd in a C program. Are there any standard Linux functions that do a such functions?

标签: c linux
1条回答
乱世女痞
2楼-- · 2020-04-10 03:28

There is adduser and deluser. Use man deluser for details.

EDIT: i missed the C part in the question.

man is also your friend in this case. With man 3 deluser you can ask if there is anything in stdlib called like that. Read https://unix.stackexchange.com/questions/3586/what-do-the-numbers-in-a-man-page-mean for more informations on that.

This is not the case. You might want to call the unix tool from within C: How do you write a C program to execute another program?

查看更多
登录 后发表回答