本文介绍了如何在/etc/passwd中添加,删除编辑用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C程序中添加或删除或编辑/etc/passwd的用户名.有标准的Linux功能可以执行此类功能吗?

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?

推荐答案

adduserdeluser.使用man deluser了解详情.

我错过了问题中的C部分.

i missed the C part in the question.

man也是您的朋友.使用man 3 deluser,您可以询问stdlib中是否有类似的名称.阅读 https://unix.stackexchange.com/questions /3586/在某人页面中的数字是什么以获取有关此信息的更多信息.

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.

情况并非如此.您可能要在C中调用Unix工具:您如何编写C程序来执行另一个程序?

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?

这篇关于如何在/etc/passwd中添加,删除编辑用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 22:14