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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has answers here:
Closed 3 years ago.
回答1:
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?