- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<User.Name,V>
-
- com.aoindustries.aoserv.client.linux.CachedObjectUserNameKey<User>
-
- com.aoindustries.aoserv.client.linux.User
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Disablable,PasswordProtected,Removable,SingleTableObject<User.Name,User>
public final class User extends CachedObjectUserNameKey<User> implements PasswordProtected, Removable, Disablable
One user may have shell, FTP, and/or email access to any number of servers. However, some of the information is common across all machines, and that set of information is contained in aLinuxAccount.- Author:
- AO Industries, Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUser.GecosUsed for the various user-provided fields in the/etc/passwdfile.static classUser.NameRepresents a Linux username.
-
Field Summary
Fields Modifier and Type Field Description static User.NameACCOUNTINGSome commonly used system and application account usernames.static User.NameADMSome commonly used system and application account usernames.static User.NameAOADMINSome commonly used system and application account usernames.static User.NameAOSERV_JILTERSome commonly used system and application account usernames.static User.NameAOSERV_MASTERSome commonly used system and application account usernames.static User.NameAOSERV_XEN_MIGRATIONSome commonly used system and application account usernames.static User.NameAPACHESome commonly used system and application account usernames.static User.NameAVAHI_AUTOIPDSome commonly used system and application account usernames.static User.NameAWSTATSSome commonly used system and application account usernames.static User.NameBILLINGSome commonly used system and application account usernames.static User.NameBINSome commonly used system and application account usernames.static User.NameBIRDSome commonly used system and application account usernames.static User.NameCENTOSSome commonly used system and application account usernames.static User.NameCHRONYSome commonly used system and application account usernames.static User.NameCLAMSCANSome commonly used system and application account usernames.static User.NameCLAMUPDATESome commonly used system and application account usernames.static User.NameCYRUSSome commonly used system and application account usernames.static User.NameDAEMONSome commonly used system and application account usernames.static User.NameDBUSSome commonly used system and application account usernames.static User.NameDHCPDSome commonly used system and application account usernames.static User.NameDISTRIBUTIONSome commonly used system and application account usernames.static User.NameEMAILMONSome commonly used system and application account usernames.static User.NameFTPSome commonly used system and application account usernames.static User.NameFTPMONSome commonly used system and application account usernames.static User.NameGAMESSome commonly used system and application account usernames.static User.NameHALTSome commonly used system and application account usernames.static User.NameHTTPDDeprecated.User httpd no longer used.static User.NameINFRASTRUCTURESome commonly used system and application account usernames.static User.NameINTERBASESome commonly used system and application account usernames.static User.NameLPSome commonly used system and application account usernames.static User.NameMAILSome commonly used system and application account usernames.static User.NameMAILNULLSome commonly used system and application account usernames.static User.NameMANAGEMENTSome commonly used system and application account usernames.static User.NameMEMCACHEDSome commonly used system and application account usernames.static User.NameMONITORINGSome commonly used system and application account usernames.static User.NameMYSQLSome commonly used system and application account usernames.static User.NameNAMEDSome commonly used system and application account usernames.static User.NameNFSNOBODYSome commonly used system and application account usernames.static User.NameNGINXSome commonly used system and application account usernames.static StringNO_PASSWORD_CONFIG_VALUEstatic User.NameNOBODYSome commonly used system and application account usernames.static User.NameOPERATORSome commonly used system and application account usernames.static User.NamePOLKITDSome commonly used system and application account usernames.static User.NamePOSTGRESSome commonly used system and application account usernames.static User.NameREDISSome commonly used system and application account usernames.static User.NameRESELLERSome commonly used system and application account usernames.static User.NameROOTSome commonly used system and application account usernames.static User.NameRPCSome commonly used system and application account usernames.static User.NameRPCUSERSome commonly used system and application account usernames.static User.NameSASLAUTHSome commonly used system and application account usernames.static User.NameSHUTDOWNSome commonly used system and application account usernames.static User.NameSMMSPSome commonly used system and application account usernames.static User.NameSSHDSome commonly used system and application account usernames.static User.NameSYNCSome commonly used system and application account usernames.static User.NameSYSTEMD_BUS_PROXYSome commonly used system and application account usernames.static User.NameSYSTEMD_NETWORKSome commonly used system and application account usernames.static User.NameTCPDUMPSome commonly used system and application account usernames.static User.NameTSSSome commonly used system and application account usernames.static User.NameUNBOUNDSome commonly used system and application account usernames.-
Fields inherited from class com.aoindustries.aoserv.client.linux.CachedObjectUserNameKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
Fields inherited from interface com.aoindustries.aoserv.client.password.PasswordProtected
ALL, NONE, SOME
-
-
Constructor Summary
Constructors Constructor Description User()
-
Method Summary
-
Methods inherited from class com.aoindustries.aoserv.client.linux.CachedObjectUserNameKey
equals, getKey, hashCode, toStringImpl
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
ADM
public static final User.Name ADM
Some commonly used system and application account usernames.
-
AOADMIN
public static final User.Name AOADMIN
Some commonly used system and application account usernames.
-
AOSERV_JILTER
public static final User.Name AOSERV_JILTER
Some commonly used system and application account usernames.
-
AOSERV_XEN_MIGRATION
public static final User.Name AOSERV_XEN_MIGRATION
Some commonly used system and application account usernames.
-
APACHE
public static final User.Name APACHE
Some commonly used system and application account usernames.
-
AVAHI_AUTOIPD
public static final User.Name AVAHI_AUTOIPD
Some commonly used system and application account usernames.
-
AWSTATS
public static final User.Name AWSTATS
Some commonly used system and application account usernames.
-
BIN
public static final User.Name BIN
Some commonly used system and application account usernames.
-
BIRD
public static final User.Name BIRD
Some commonly used system and application account usernames.
-
CENTOS
public static final User.Name CENTOS
Some commonly used system and application account usernames.
-
CHRONY
public static final User.Name CHRONY
Some commonly used system and application account usernames.
-
CLAMSCAN
public static final User.Name CLAMSCAN
Some commonly used system and application account usernames.
-
CLAMUPDATE
public static final User.Name CLAMUPDATE
Some commonly used system and application account usernames.
-
CYRUS
public static final User.Name CYRUS
Some commonly used system and application account usernames.
-
DAEMON
public static final User.Name DAEMON
Some commonly used system and application account usernames.
-
DBUS
public static final User.Name DBUS
Some commonly used system and application account usernames.
-
DHCPD
public static final User.Name DHCPD
Some commonly used system and application account usernames.
-
EMAILMON
public static final User.Name EMAILMON
Some commonly used system and application account usernames.
-
FTP
public static final User.Name FTP
Some commonly used system and application account usernames.
-
FTPMON
public static final User.Name FTPMON
Some commonly used system and application account usernames.
-
GAMES
public static final User.Name GAMES
Some commonly used system and application account usernames.
-
HALT
public static final User.Name HALT
Some commonly used system and application account usernames.
-
INTERBASE
public static final User.Name INTERBASE
Some commonly used system and application account usernames.
-
LP
public static final User.Name LP
Some commonly used system and application account usernames.
-
MAIL
public static final User.Name MAIL
Some commonly used system and application account usernames.
-
MAILNULL
public static final User.Name MAILNULL
Some commonly used system and application account usernames.
-
MEMCACHED
public static final User.Name MEMCACHED
Some commonly used system and application account usernames.
-
MYSQL
public static final User.Name MYSQL
Some commonly used system and application account usernames.
-
NAMED
public static final User.Name NAMED
Some commonly used system and application account usernames.
-
NFSNOBODY
public static final User.Name NFSNOBODY
Some commonly used system and application account usernames.
-
NGINX
public static final User.Name NGINX
Some commonly used system and application account usernames.
-
NOBODY
public static final User.Name NOBODY
Some commonly used system and application account usernames.
-
OPERATOR
public static final User.Name OPERATOR
Some commonly used system and application account usernames.
-
POLKITD
public static final User.Name POLKITD
Some commonly used system and application account usernames.
-
POSTGRES
public static final User.Name POSTGRES
Some commonly used system and application account usernames.
-
REDIS
public static final User.Name REDIS
Some commonly used system and application account usernames.
-
ROOT
public static final User.Name ROOT
Some commonly used system and application account usernames.
-
RPC
public static final User.Name RPC
Some commonly used system and application account usernames.
-
RPCUSER
public static final User.Name RPCUSER
Some commonly used system and application account usernames.
-
SASLAUTH
public static final User.Name SASLAUTH
Some commonly used system and application account usernames.
-
SHUTDOWN
public static final User.Name SHUTDOWN
Some commonly used system and application account usernames.
-
SMMSP
public static final User.Name SMMSP
Some commonly used system and application account usernames.
-
SSHD
public static final User.Name SSHD
Some commonly used system and application account usernames.
-
SYNC
public static final User.Name SYNC
Some commonly used system and application account usernames.
-
SYSTEMD_BUS_PROXY
public static final User.Name SYSTEMD_BUS_PROXY
Some commonly used system and application account usernames.
-
SYSTEMD_NETWORK
public static final User.Name SYSTEMD_NETWORK
Some commonly used system and application account usernames.
-
TCPDUMP
public static final User.Name TCPDUMP
Some commonly used system and application account usernames.
-
TSS
public static final User.Name TSS
Some commonly used system and application account usernames.
-
UNBOUND
public static final User.Name UNBOUND
Some commonly used system and application account usernames.
-
AOSERV_MASTER
public static final User.Name AOSERV_MASTER
Some commonly used system and application account usernames.
-
ACCOUNTING
public static final User.Name ACCOUNTING
Some commonly used system and application account usernames.
-
BILLING
public static final User.Name BILLING
Some commonly used system and application account usernames.
-
DISTRIBUTION
public static final User.Name DISTRIBUTION
Some commonly used system and application account usernames.
-
INFRASTRUCTURE
public static final User.Name INFRASTRUCTURE
Some commonly used system and application account usernames.
-
MANAGEMENT
public static final User.Name MANAGEMENT
Some commonly used system and application account usernames.
-
MONITORING
public static final User.Name MONITORING
Some commonly used system and application account usernames.
-
RESELLER
public static final User.Name RESELLER
Some commonly used system and application account usernames.
-
HTTPD
@Deprecated public static final User.Name HTTPD
Deprecated.User httpd no longer used.
-
NO_PASSWORD_CONFIG_VALUE
public static final String NO_PASSWORD_CONFIG_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
addFTPGuestUser
public void addFTPGuestUser() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
addLinuxGroup
public void addLinuxGroup(Group group) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addLinuxServerAccount
public int addLinuxServerAccount(Server aoServer, PosixPath home) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
arePasswordsSet
public int arePasswordsSet() throws IOException, SQLException- Specified by:
arePasswordsSetin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
canDisable
public boolean canDisable() throws IOException, SQLException- Specified by:
canDisablein interfaceDisablable- Throws:
IOExceptionSQLException
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
checkPassword
public List<PasswordChecker.Result> checkPassword(String password) throws IOException
- Specified by:
checkPasswordin interfacePasswordProtected- Throws:
IOException
-
checkPassword
public static List<PasswordChecker.Result> checkPassword(User.Name username, String type, String password) throws IOException
Checks the strength of a password as required for thisLinuxAccount. The strength requirement depends on theLinuxAccountType.
-
disable
public void disable(DisableLog dl) throws IOException, SQLException
- Specified by:
disablein interfaceDisablable- Throws:
IOExceptionSQLException
-
enable
public void enable() throws IOException, SQLException- Specified by:
enablein interfaceDisablable- Throws:
IOExceptionSQLException
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<User.Name,User>
-
getCreated
public UnmodifiableTimestamp getCreated()
-
isDisabled
public boolean isDisabled()
Description copied from interface:DisablableChecks if this object is disabled. This should execute very quickly (not incur any round-trip to any database) and thus does not throw any checked exceptions.- Specified by:
isDisabledin interfaceDisablable
-
getDisableLog
public DisableLog getDisableLog() throws SQLException, IOException
- Specified by:
getDisableLogin interfaceDisablable- Throws:
SQLExceptionIOException
-
getFTPGuestUser
public GuestUser getFTPGuestUser() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHomePhone
public User.Gecos getHomePhone()
-
getLinuxGroups
public List<Group> getLinuxGroups() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerAccount
public UserServer getLinuxServerAccount(Server aoServer) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerAccounts
public List<UserServer> getLinuxServerAccounts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getName
public User.Gecos getName()
-
getOfficeLocation
public User.Gecos getOfficeLocation()
-
getOfficePhone
public User.Gecos getOfficePhone()
-
getPrimaryGroup
public Group getPrimaryGroup() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getShell
public Shell getShell() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<User.Name,User>
-
getType
public UserType getType() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getUsername_id
public User.Name getUsername_id()
-
getUsername
public User getUsername() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getValidHomeDirectories
public List<PosixPath> getValidHomeDirectories(Server ao) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getValidHomeDirectories
public static List<PosixPath> getValidHomeDirectories(User.Name username, Server ao) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<User.Name,User>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<User.Name,User>- Throws:
IOException
-
getCannotRemoveReasons
public List<CannotRemoveReason<?>> getCannotRemoveReasons() throws SQLException, IOException
Description copied from interface:RemovableLists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasonsin interfaceRemovable- Returns:
- an empty
List<CannotRemoveReason>if this object may be removed, or a list of descriptions - Throws:
SQLExceptionIOException
-
remove
public void remove() throws IOException, SQLExceptionDescription copied from interface:RemovableRemoves this object, and all dependant objects, from the system.- Specified by:
removein interfaceRemovable- Throws:
IOExceptionSQLException
-
removeLinuxGroup
public void removeLinuxGroup(Group group) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setHomePhone
public void setHomePhone(User.Gecos phone) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setName
public void setName(User.Gecos name) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setOfficeLocation
public void setOfficeLocation(User.Gecos location) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setOfficePhone
public void setOfficePhone(User.Gecos phone) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setPassword
public void setPassword(String password) throws SQLException, IOException
- Specified by:
setPasswordin interfacePasswordProtected- Throws:
SQLExceptionIOException
-
setShell
public void setShell(Shell shell) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<User.Name,User>- Throws:
IOException
-
canSetPassword
public boolean canSetPassword() throws IOException, SQLException- Specified by:
canSetPasswordin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
setPrimaryLinuxGroup
public void setPrimaryLinuxGroup(Group group) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
-