Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos.package
Commits
723dd8f6
Commit
723dd8f6
authored
Jul 01, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add home path when modifiy account by slapformat
parent
5dd596a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
windows/scripts/usermod
windows/scripts/usermod
+51
-0
No files found.
windows/scripts/usermod
View file @
723dd8f6
...
...
@@ -26,3 +26,54 @@
#
# ------------------------------------------------------------------------------
#
# Simulate the command usermod to change a user on the Cygwin
# usermod -d path -g init-group -s /bin/false -G group NAME
#
# -g, --gid GROUP
# The group name or number of the user's new initial login group. The group must exist.
#
# -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
# A list of supplementary groups which the user is also a member of.
#
# -s
# Shell used by user
#
while
getopts
"Dd:g:G:p:s:r"
opt
;
do
case
$opt
in
d
)
USER_HOME
=
$OPTARG
;;
g
)
USER_INIT_GROUP
=
grp_
$OPTARG
;;
G
)
USER_OTHER_GROUP
=
grp_
$OPTARG
;;
p
)
USER_PASSWORD
=
$OPTARG
;;
s
)
USER_SHELL
=
$OPTARG
;;
r
)
;;
*
)
echo
Error when add user
in
the Cygwin
exit
1
;;
esac
done
shift
$((
$OPTIND
-
1
))
USER_NAME
=
$1
if
[[
"
$USER_NAME
"
==
""
]]
;
then
echo
Error: no user name specified.
exit
1
fi
USER_HOME
=
${
USER_HOME
:
=/home/
$USER_NAME
}
grep
-q
"^
${
USER_NAME
}
"
/etc/passwd
||
mkpasswd |
grep
"^
${
USER_NAME
}
:"
>>
/etc/passwd
[[
$USER_HOME
==
"/home/
$USER_NAME
"
]]
||
sed
-i
-e
"s%:/home/
${
USER_NAME
}
:%:
${
USER_HOME
}
:%g"
/etc/passwd
[[
!
"
$USER_HOME
"
==
""
]]
&&
[[
!
-f
$USER_HOME
]]
&&
mkdir
-p
$USER_HOME
&&
chown
$USER_NAME
$USER_HOME
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment