A method for producing 4-formylaminopiperidine derivatives of the formula in which n is 1 or 2, R 1, R 2, R 3 and R 4, independently of one another, are identical or different and are C 1 -C 4 -alkyl or R 1 and R 2 or R 3 and R 4 together are a tetramethylene or pentamethylene group, R 5 is hydrogen or C 1 -C 4 -alkyl, R 6 is hydrogen, oxygen, C 1 -C 22 -alkyl, C 3 -C 22 -alkenyl, C 1 -C 22 -alkoxy, unsubstituted or substituted C 7 -C 12 -phenylalkyl, C 1 -C 22 -alkanoyl, C 2 -C 3 -cyanoalkyl, C 1 -C 22 -hydroxyalkyl or C 2 -C 22 -aminoalkyl and - if n = 1 - Y is hydrogen, C 1 -C 22 -alkyl, C 3 -C 22 -alkenyl, C 3 -C 12 -cycloalkyl or bicycloalkyl, C 2 -C 22 -alkyl substituted by cyano, hydroxy or C 1 -C 4 -alkoxy, C 4 -C 22 -alkyl interrupted by ether oxygen, nitrogen or sulfur, unsubstituted or substituted C 7 -C 22 -phenyl or diphenylalkyl, unsubstituted or substituted phenyl, a radical of the formula or C 1 -C 22 -alkyl comprising heterocyclic radicals, or - when n = 2 - Y is C 2 -C 22 -alkylene, C 5 -C 22 -cycloalkylene, C 8 -C 14 -phenylalkylene, phenylene or C 4 -C 30 -alkylene interrupted by ether oxygen, nitrogen, sulfur or 5- or 6-membered heterocycles, and also the acid addition salts of these compounds, comprising the reaction of 4-aminopiperidine derivatives of the formula or the acid addition salts of these compounds in the presence of compounds of the formula where R 7, R 8, independently of one another, are identical or different and are hydrogen, C 1 -C 22 -alkyl, C 3 - C 22 -alkenyl, unsubstituted or substituted C 7 -C 12 -phenylalkyl, or C 1 -C 22 -alkanoyl, and the reaction takes place in the presence of at least one protic acid and at least one Lewis acid. n is 1 or 2, R 1, R 2, R 3 and R 4, independently of one another, are identical or different and are C 1 -C 4 -alkyl or R 1 and R 2 or R 3 and R 4 together are a tetramethylene or pentamethylene group, R 5 is hydrogen or C 1 -C 4 -alkyl, R 6 is hydrogen, oxygen, C 1 -C 22 -alkyl, C 3 -C 22 -alkenyl, C 1 -C 22 -alkoxy, unsubstituted or substituted C 7 -C 12 -phenylalkyl, C 1 -C 22 -alkanoyl, C 2 -C 3 -cyanoalkyl, C 1 -C 22 -hydroxyalkyl or C 2 -C 22 -aminoalkyl and - if n = 1 - Y is hydrogen, C 1 -C 22 -alkyl, C 3 -C 22 -alkenyl, C 3 -C 12 -cycloalkyl or bicycloalkyl, C 2 -C 22 -alkyl substituted by cyano, hydroxy or C 1 -C 4 -alkoxy, C 4 -C 22 -alkyl interrupted by ether oxygen, nitrogen or sulfur, unsubstituted or substituted C 7 -C 22 -phenyl or diphenylalkyl, unsubstituted or substituted phenyl, a radical of the formula or C 1 -C 22 -alkyl comprising heterocyclic radicals, or - when n = 2 - Y is C 2 -C 22 -alkylene, C 5 -C 22 -cycloalkylene, C 8 -C 14 -phenylalkylene, phenylene or C 4 -C 30 -alkylene interrupted by ether oxygen, nitrogen, sulfur or 5- or 6-membered heterocycles, and also the acid addition salts of these compounds, comprising the reaction of 4-aminopiperidine derivatives of the formula or the acid addition salts of these compounds in the presence of compounds of the formula where R 7, R 8, independently of one another, are identical or different and are hydrogen, C 1 -C 22 -alkyl, C 3 - C 22 -alkenyl, unsubstituted or substituted C 7 -C 12 -phenylalkyl, or C 1 -C 22 -alkanoyl, and the reaction takes place in the presence of at least one protic acid and at least one Lewis acid.